Guest User

Untitled

a guest
Jun 18th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. <?php
  2.  
  3. $address = "0.0.0.0";
  4. $port = "9999";
  5. $servername = "fake.irc.server";
  6. /* create a socket in the AF_INET family, using SOCK_STREAM for TCP connection */
  7. $mysock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
  8. socket_bind($mysock, $address, $port);
  9. socket_listen($mysock, 5);
  10. while(true) {
  11. $client = socket_accept($mysock);
  12. // Say Looking up hostname
  13. $output = $servername . "NOTICE Auth :Please wait while we process your connection...";
  14. socket_write($client, $output);
  15. // Read the input from the client
  16. $input = socket_read($client, 1024);
  17. $output = $servername . "NOTICE Auth :Thank you for being tricked into connecting to this server! Your nick is:" . $input;
  18.  
  19. // Display output back to client
  20. socket_write($client, $output);
  21.  
  22. // CLOSE CONNECTION AND LOOP
  23. socket_close($client);
  24. }
  25.  
  26. ?>
Add Comment
Please, Sign In to add comment