Advertisement
YourMain12

Serverside API Executor

May 5th, 2023
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.46 KB | None | 0 0
  1. using System;
  2. using System.Net;
  3. using System.Net.Sockets;
  4. using System.Text;
  5.  
  6. class Program
  7. {
  8.     static void Main(string[] args)
  9.     {
  10.         string host = "game.roblox.com";
  11.         int port = 53640;
  12.         IPEndPoint endPoint = new IPEndPoint(Dns.GetHostAddresses(host)[0], port);
  13.         Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  14.         socket.Connect(endPoint);
  15.  
  16.         // Send the server request
  17.         string payload = "GET / HTTP/1.1\r\nHost: game.roblox.com\r\n\r\n";
  18.         byte[] request = Encoding.ASCII.GetBytes(payload);
  19.         socket.Send(request);
  20.  
  21.         // Receive the server response
  22.         byte[] buffer = new byte[4096];
  23.         int count = socket.Receive(buffer);
  24.  
  25.         // Extract the necessary data from the server response
  26.         string response = Encoding.ASCII.GetString(buffer, 0, count);
  27.         int startIndex = response.IndexOf("token=") + 6;
  28.         int endIndex = response.IndexOf("&", startIndex);
  29.         string token = response.Substring(startIndex, endIndex - startIndex);
  30.  
  31.         string script = "print('Hello from serverside!')";
  32.         payload = "POST /game/join.ashx?token=" + token + " HTTP/1.1\r\nHost: game.roblox.com\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: " + script.Length + "\r\n\r\n" + script;
  33.         request = Encoding.ASCII.GetBytes(payload);
  34.         socket.Send(request);
  35.  
  36.         socket.Close();
  37.     }
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement