SHARE
TWEET

Untitled

a guest Aug 22nd, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. print "Creating HID...";
  2. system("modprobe libcomposite");
  3.  
  4. make_path("/sys/kernel/config/usb_gadget/pwman/");
  5. doWriteFile("idVendor","0x1d6b");
  6. doWriteFile("bcdDevice","0x0104");
  7. doWriteFile("bcdUSB","0x0200");
  8. doWriteFile("bDeviceClass","0xEF");
  9. doWriteFile("bDeviceSubClass","0x03");
  10. doWriteFile("bDeviceProtocol","0x01");
  11. make_path("/sys/kernel/config/usb_gadget/pwman/strings/0x409/");
  12. doWriteFile("strings/0x409/serialnumber","0000000001");
  13. doWriteFile("strings/0x409/manufacturer","Sebastian Nielsen");
  14. doWriteFile("strings/0x409/product","Sebastian Nielsen's Password Manager");
  15. make_path("/sys/kernel/config/usb_gadget/pwman/functions/hid.usb0/");
  16. doWriteFile("functions/hid.usb0/protocol","1");
  17. doWriteFile("functions/hid.usb0/subclass","1");
  18. doWriteFile("functions/hid.usb0/report_length","8");
  19. doWriteFile("functions/hid.usb0/report_desc_length","63");
  20. doWriteFile("functions/hid.usb0/report_desc","\x05\x01\x09\x06\xa1\x01\x05\x07\x19\xe0\x29\xe7\x15\x00\x25\x01\x75\x01\x95\x08\x81\x02\x95\x01\x75\x08\x81\x03\x95\x05\x75\x01\x05\x08\x19\x01\x29\x05\x91\x02\x95\x01\x75\x03\x91\x03\x95\x06\x75\x08\x15\x00\x25\x65\x05\x07\x19\x00\x29\x65\x81\x00\xc0");
  21. make_path("/sys/kernel/config/usb_gadget/pwman/configs/c.1/strings/0x409/");
  22. doWriteFile("configs/c.1/strings/0x409/configuration","Config 1: ECM network");
  23. doWriteFile("configs/c.1/MaxPower","300");
  24. symlink("/sys/kernel/config/usb_gadget/pwman/functions/hid.usb0","/sys/kernel/config/usb_gadget/pwman/configs/c.1/hid.usb0");
  25. opendir(DIRCONTENT, "/sys/class/udc");
  26. @allfiles = readdir(DIRCONTENT);
  27. closedir(DIRCONTENT);
  28. $dircontent = "";
  29. foreach $dcontent (@allfiles) {
  30.   if (($dcontent ne ".")&&($dcontent ne "..")) {
  31.     $dircontent = $dircontent . $dcontent . "\n";
  32.   }
  33. }
  34. $dircontent =~ s/\n$//si;
  35. doWriteFile("UDC",$dircontent);
  36.  
  37.  
  38. sub doWriteFile() {
  39.   $wfilename = shift;
  40.   $wstring = shift;
  41.   open(WFILE, ">/sys/kernel/config/usb_gadget/pwman/".$wfilename);
  42.   print WFILE $wstring;
  43.   close(WFILE);
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top