Advertisement
Guest User

Untitled

a guest
May 11th, 2017
554
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3.  
  4. # +-------------------------------------+
  5. # | Multi-Protocol Honeypot (MPH v0.1) |
  6. # |-------------------------------------|
  7. # | A feeble attempt at doing something |
  8. # | constructive with my time. |
  9. # |-------------------------------------|
  10. # | --- By: k0pp | SABS Coding --- |
  11. # | -- irc.system-abuse.net:+6697 -- |
  12. # +-------------------------------------+
  13.  
  14.  
  15. use warnings;
  16. use strict qw(vars);
  17.  
  18. use IO::Socket;
  19. use Net::hostent;
  20. use Term::ANSIColor;
  21. my %config = (
  22. "ftp" => 21,
  23. "ssh" => 22,
  24. "telnet" => 23,
  25. "VNC" => 5900,
  26. "verbosity" => 1,
  27. );
  28. #my $log = `echo \$LOGNAME`;
  29. #die("Must run as root") unless $log eq 'root';
  30.  
  31. my $telnet = IO::Socket::INET->new( LocalAddr => 'localhost',
  32. Proto => 'tcp',
  33. LocalPort => $config{telnet},
  34. Listen => 1,
  35. Reuse => 1,
  36. );
  37. die("Cant start TELNET daemon.. $$") unless $telnet;
  38.  
  39. print "[TELNET honeypot waiting for connections...]\n";
  40. while ($telnet = $telnet->accept()) {
  41. $telnet->autoflush(1);
  42. print $telnet "\n\nUser Access Verification\n\n";
  43. my $hostinfo = gethostbyaddr($telnet->peeraddr);
  44. print $telnet "Username: ";
  45. chomp(my $uat = <$telnet>);
  46. print $telnet "\nOk.\n\nPassword: ";
  47. while(my $pat = <$telnet>){
  48. chop $pat;
  49. if($pat =~ /(?:admin|root|password)/){
  50. print $telnet "\nOk.\n\n";
  51. telog("[TELNET]: Login from " . $telnet->peerhost,"(".$uat."/".$pat.")");
  52. last;
  53. }
  54. else {
  55. print $telnet "\nWrong.\nPassword: ";
  56. }
  57. }
  58. print $telnet "Command: ";
  59. while (my $body = <$telnet>) {
  60. chop $body;
  61. telog("[TELNET]: " . $telnet->peerhost,"Command: " . $body);
  62. print $telnet "$body is not a recognized command\n";
  63. print $telnet "Command: ";
  64. }
  65. close $telnet;
  66. }
  67.  
  68. sub telog {
  69. if($config{verbosity} == 1){
  70. print color 'bold red';
  71. print "$_[0] $_[1]\n";
  72. print color 'reset';
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement