Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinbreiz committed Dec 27, 2017
1 parent d040abe commit 46d13c3
Show file tree
Hide file tree
Showing 36 changed files with 2,033 additions and 0 deletions.
25 changes: 25 additions & 0 deletions PS4 Payload Sender.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2010
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PS4 Payload Sender", "PS4 Payload Sender\PS4 Payload Sender.csproj", "{6D5D7510-5751-4D2F-BCBB-F21445FB7AE3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6D5D7510-5751-4D2F-BCBB-F21445FB7AE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D5D7510-5751-4D2F-BCBB-F21445FB7AE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D5D7510-5751-4D2F-BCBB-F21445FB7AE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D5D7510-5751-4D2F-BCBB-F21445FB7AE3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3B855644-8A59-4885-8636-AAFA598FF105}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions PS4 Payload Sender/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
191 changes: 191 additions & 0 deletions PS4 Payload Sender/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

103 changes: 103 additions & 0 deletions PS4 Payload Sender/Form1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
using System;
using System.Net;
using System.Net.Sockets;
using System.Windows.Forms;

namespace PS4_Payload_Sender
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "")
{
MessageBox.Show("Please enter an IP address.");
}
else
{
bool result = Connect2PS4(textBox1.Text, textBox2.Text);
if (!result)
{
MessageBox.Show("Error while connecting.\n" + Exception);
}
else
{
groupBox1.Enabled = false;
groupBox2.Enabled = true;
}
}
}

public static Socket _psocket;
public static bool pDConnected;
public static string Exception;

public static bool Connect2PS4(string ip, string port)
{
try
{
_psocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_psocket.ReceiveTimeout = 3000;
_psocket.SendTimeout = 3000;
_psocket.Connect(new IPEndPoint(IPAddress.Parse(ip), Int32.Parse(port)));
pDConnected = true;
return true;
}
catch (Exception ex)
{
pDConnected = false;
Exception = ex.ToString();
return false;
}
}

public static bool SendPayload(string filename)
{
_psocket.SendFile(filename);
return true;
}

public static bool DisconnectPayload()
{
pDConnected = false;
_psocket.Close();
return true;
}

private void Form1_Load(object sender, EventArgs e)
{
groupBox2.Enabled = false;
groupBox3.Enabled = false;
}

public static string path;

private void button2_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
path = openFileDialog1.FileName;
button2.Text = path;
groupBox2.Enabled = false;
groupBox3.Enabled = true;
}

private void button3_Click(object sender, EventArgs e)
{
try
{
SendPayload(path);
DisconnectPayload();
MessageBox.Show("Payload sent!");
}
catch (Exception ex)
{
MessageBox.Show("Error!\n"+ ex);
}
}
}
}
Loading

0 comments on commit 46d13c3

Please sign in to comment.