Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace WebRecorder
  9. {
  10. class Program
  11. {
  12. public static System.Net.Sockets.TcpListener tcpListener = new System.Net.Sockets.TcpListener(System.Net.IPAddress.Parse("127.0.0.1"), 80);
  13. public static byte[] buffer = new byte[1024 * 8];
  14.  
  15. static void Main(string[] args)
  16. {
  17. tcpListener.Start();
  18. while (true)
  19. {
  20. System.Net.Sockets.TcpClient tcpClient = tcpListener.AcceptTcpClient();
  21. // Read the data stream from the client.
  22. System.Net.Sockets.NetworkStream stream = tcpClient.GetStream();
  23. int len = stream.Read(buffer, 0, buffer.Length);
  24. tcpClient.Close();
  25. byte[] trimmed = new byte[len];
  26. Buffer.BlockCopy(buffer, 0, trimmed, 0, len);
  27. File.WriteAllBytes("dump.bin", trimmed);
  28. }
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement