Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Perl Reddit source

By: a guest on Oct 19th, 2012  |  syntax: None  |  size: 2.08 KB  |  hits: 320  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #ALPHA Test development program to poll for new Reddit user mail.
  2. #
  3. #
  4. #Developed by knivesngunz 2012
  5. ##############################
  6. ##############################
  7. use Device::SerialPort;
  8.  
  9. $serialport = "/dev/ttyACM1";
  10.  
  11.  
  12. $port = Device::SerialPort->new($serialport);
  13. $port->databits(8);
  14. $port->baudrate(9600);
  15. $port->parity("none");
  16. $port->stopbits(1);
  17. $port->dtr_active(0);
  18.  
  19.  
  20.  
  21.  
  22. $user = "INSERT YOUR USERNAME HERE";
  23. $pass = "INSERT YOUR PASSWORD HERE ";
  24.  
  25. print "[+] Housekeeping first...\n";
  26. `rm Cookie.txt`;
  27. `rm about.json`;
  28.  
  29.  
  30. print "[+] Attempting to establish login session...\n[   +    ]\n";
  31. system("curl -d user=$user -d passwd=$pass -c Cookie.txt http://www.reddit.com/api/login");
  32. print "\n[   +   ]\n";
  33.  
  34.  
  35. while (1){
  36.         print "[+] Logged in as $user\n";
  37.         print "[+] Getting JSON details...\n";
  38.         `wget -q -O unread.json --load-cookies=Cookie.txt http://www.reddit.com/message/unread/.json`;
  39.  
  40.         print "[+] Parsing JSON info...\n";
  41.         open MYFILE, "<unread.json";
  42.         $JSONinfo = <MYFILE>;
  43.         if ($JSONinfo =~ /author/){
  44.                 $count = 0;
  45.                 $count++ while ($JSONinfo =~ /author/g);
  46.                 if ($oldcount != $count){                
  47.                         $oldcount = $count;            
  48.                         &turnoffalert;
  49.                         sleep(1);                      
  50.                         &turnonalert;
  51.                         $firstalert=0;                        
  52.                 }
  53.                 print "[+] $count NEW MESSAGE(S)\n";
  54.                 $firstalert=1;
  55.                
  56.         }
  57.         else {
  58.                 print "no mail..\n";
  59.                 &turnoffalert;
  60.                 $firstalert = 0;
  61.                 $oldcount = 0;
  62.         }
  63.         sleep(10);      #       THIS IS HOW LONG TO WAIT BEFORE WE TRY TO POLL AGAIN!!! Always leave at 30 seconds or greater!
  64.         system("clear");
  65. }
  66.  
  67.  
  68. sub turnonalert() {
  69.         #if ($firstalert == 0){
  70.                 $port->write("1,0,\r");
  71.         #}
  72. }
  73.  
  74. sub turnoffalert() {
  75. $port->write("0,0,\r");
  76. }