示例#1
0
        private void ExitServer()
        {
            Structures.TCPCommandComplex com = new Structures.TCPCommandComplex();
            com.command = 0508;
            com.param   = "DUMMY";

            byte[] tmp = Structures.getBytesFromStruct(com);

            if (Client.Client.Available > 0)
            {
                byte[] tmp2 = new byte[Client.Client.Available];
                Client.Client.Receive(tmp2);
            }

            Network.WriteU32((UInt32)tmp.Length, this.Client.Client);
            Thread.Sleep(50);
            byte res = Network.ReadByte(this.Client.Client);

            if (res != 0x4f)
            {
                return;
            }

            Thread.Sleep(50);
            Network.WriteBytes(tmp, this.Client.Client);
            Thread.Sleep(50);
            this.Client.Close();
            return;
        }
示例#2
0
        public static byte[] ps4ninja_get_dents(string path, TcpClient Client)
        {
            Structures.TCPCommandComplex com = new Structures.TCPCommandComplex();
            com.command = 0510;
            com.param   = path;

            byte[] tmp = Structures.getBytesFromStruct(com);

            return(Network.SendCommand(tmp, false, "", Client));
        }
示例#3
0
        public static UInt64 ps4ninja_enable_userland_aslr(TcpClient Client)
        {
            Structures.TCPCommandComplex com = new Structures.TCPCommandComplex();
            com.command = 2827;
            com.param   = "DUMMY";

            byte[] tmp = Structures.getBytesFromStruct(com);
            tmp = Network.SendCommand64(tmp, false, "", Client, true);

            return(BitConverter.ToUInt64(tmp, 0));
        }
示例#4
0
        public static UInt64 ps4ninja_execve(string filename, TcpClient Client)
        {
            Structures.TCPCommandComplex com = new Structures.TCPCommandComplex();
            com.command = 2821;
            com.param   = filename;

            byte[] tmp = Structures.getBytesFromStruct(com);
            tmp = Network.SendCommand64(tmp, false, "", Client, true);

            return(BitConverter.ToUInt64(tmp, 0));
        }
示例#5
0
        private void mnuProcesses_Click(object sender, EventArgs e)
        {
            Structures.TCPCommandComplex com = new Structures.TCPCommandComplex();
            com.command = 2803;
            com.param   = "DUMMY";

            byte[] tmp = Structures.getBytesFromStruct(com);
            tmp = Network.SendCommand64(tmp, false, "", this.Client, true);

            frmProcesses FormProc = new frmProcesses();

            FormProc.Client      = this.Client;
            FormProc.ProcessData = tmp;
            FormProc.Show();
        }
示例#6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(string.Format("Kill PID {0} - {1}", this.SelectedPID, this.SelectedCommand), "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                // Send kill command
                Commands.ps4ninja_kill_pid((short)this.SelectedPID, this.Client);

                //Refresh process list
                Structures.TCPCommandComplex com2 = new Structures.TCPCommandComplex();
                com2.command = 2803;
                com2.param   = "DUMMY";

                byte[] tmp = Structures.getBytesFromStruct(com2);
                tmp = Network.SendCommand64(tmp, false, "", this.Client, true);

                this.dtSet.Tables[0].Clear();
                this.ParseData(tmp);
            }
        }
示例#7
0
        private byte[] GetFile(string path, string LocalFile)
        {
            Structures.TCPCommandComplex com = new Structures.TCPCommandComplex();

            // Auto decrypt executable formats
            if (path.EndsWith(".elf") || path.EndsWith(".sprx") || path.EndsWith(".self") || path.EndsWith("eboot.bin") || path.EndsWith("prx"))
            {
                com.command = 2801;
            }
            else
            {
                com.command = 2802;
            }

            // Force normal file transfer
            //com.command = 2802;

            com.param = path;
            byte[] tmp = Structures.getBytesFromStruct(com);
            return(Network.SendCommand(tmp, true, LocalFile, this.Client));
        }
示例#8
0
        private void DownloadFile(string RemoteFile, string LocalFile)
        {
            this.Received      = 0;
            this.ReceivingFile = LocalFile;
            bool portSelected = false;

            // Create file
            if (File.Exists(LocalFile) && this.OverwriteFiles == false)
            {
                return;
            }

            while (!portSelected)
            {
                try
                {
                    // Choose random port for file transfer
                    Random rnd = new Random();
                    this.Port = rnd.Next(10000, 14000);

                    // Start data server
                    this.Listener = new TcpListener(IPAddress.Any, this.Port);
                    this.Listener.Start();
                    portSelected = true;
                }
                catch (Exception) { }
            }

            Structures.TCPCommandComplex com = new Structures.TCPCommandComplex();

            // Auto decrypt executable formats
            if (RemoteFile.EndsWith(".elf") || RemoteFile.EndsWith(".sprx") || RemoteFile.EndsWith(".self") || RemoteFile.EndsWith("eboot.bin") || RemoteFile.EndsWith("prx"))
            {
                com.command = 2801;
            }
            else
            {
                com.command = 2802;
            }

            // Force normal file transfer
            //com.command = 2802;

            com.param = RemoteFile;
            byte[] Command = Structures.getBytesFromStruct(com);

            //Send port
            byte[] Port = BitConverter.GetBytes((UInt32)this.Port);

            //Send PC IP
            UInt32 intAddress = (UInt32)BitConverter.ToInt32(IPAddress.Parse(this.CommandSock.Client.LocalEndPoint.ToString().Split(':')[0]).GetAddressBytes(), 0);

            byte[] IP = BitConverter.GetBytes(intAddress);

            this.SendingCommand = true;
            this.Filesize       = Network.SendFileRequest(Command, Port, IP, this.CommandSock);
            this.SendingCommand = false;

            if (this.Filesize > 0)
            {
                this.DataSock = Listener.AcceptTcpClient();
            }

            // Create file
            if (File.Exists(LocalFile))
            {
                File.Delete(LocalFile);
            }

            fs = new FileStream(LocalFile, FileMode.CreateNew, FileAccess.ReadWrite);

            if (Filesize == 0)       // if its an empty file, stop right here!
            {
                fs.Close();
                this.Listener.Stop();
                return;
            }


            br = new BinaryWriter(fs);

            byte[] tmp = new byte[2];

            // Receive PS4 data PID
            while (this.DataSock.Client.Available == 0)
            {
            }
            ;
            this.DataSock.Client.Receive(tmp);
            this.ClientPID = BitConverter.ToUInt16(tmp, 0);

            // Read all data that arrives over network
            while (this.Received < this.Filesize)
            {
                if (DataSock.Available != 0)
                {
                    byte[] tmpBuffer = new byte[DataSock.Available];
                    DataSock.Client.Receive(tmpBuffer);
                    br.Write(tmpBuffer);
                    this.Received += (UInt32)tmpBuffer.Length;

                    UptControls();
                }
            }

            // Close file
            br.Close();
            fs.Close();

            // Close listener server and dialog
            this.Listener.Stop();
            this.DataSock.Close();
        }