Guest User

Untitled

a guest
Nov 18th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. INSERT INTO radcheck(id, username, attribute, op, value) VALUES (,,00:23:32:c2:a9:e8,Auth-Type,:=,Accept);
  2.  
  3. INSERT INTO radcheck(id, username, attribute, op, value) VALUES (,'','00:23:32:c2:a9:e8','Auth-Type',':=','Accept');
  4.  
  5. #!/bin/bash
  6. ssh ubnt@xxx.xxx.xxx.xxx brmacs >>MACS.txt mv MACS.txt /etc/persistent scp mhalls@xxx.xxx.xxx.xxx:/etc/persistent/MACS.txt MACS.txt
  7. sed -i "1d" MACS.txt
  8. head -c 58 MACS.txt >>shortmacs.txt
  9. tail -c 18 shortmacs.txt >>usermac.txt
  10. sed 's/"//g' usermac.txt >>usermacrdy.txt
  11. sed -i 's/^/INSERT INTO `radcheck`(`id`, `username`, `attribute`, `op`, `value`) VALUES (,'',/' usermacrdy.txt
  12. sed "s/$/','Auth-Type',':=','Accept');/" usermacrdy.txt > sqlquery.txt
  13. sed -i "s/,,/,'','/" sqlquery.txt
  14. rm -f MACS.txt
  15. rm -f shortmacs.txt
  16. rm -f usermac.txt
  17. rm -f usermacrdy.txt
  18.  
  19. sed -i 's/^/INSERT INTO `radcheck`(`username`, `attribute`, `op`, `value`) VALUES (/' usermacrdy.txt
  20. sed "s/$/','Auth-Type',':=','Accept');/" usermacrdy.txt > sqlquery.txt
  21. sed -i "s/,'','//" sqlquery.txt
  22.  
  23. $ sed -r 's/,([^ ),]+)/,'''1'''/g; s/,,/,'''',/g' file
  24. INSERT INTO radcheck(id, username, attribute, op, value) VALUES (,'','00:23:32:c2:a9:e8','Auth-Type',':=','Accept');
  25.  
  26. $ sed -r "s/,([^ ),]+)/,'1'/g; s/,,/,'',/g" file
  27. INSERT INTO radcheck(id, username, attribute, op, value) VALUES (,'','00:23:32:c2:a9:e8','Auth-Type',':=','Accept');
  28.  
  29. $ cat script.sed
  30. s/,([^ ),]+)/,'1'/g
  31. s/,,/,'',/g
  32. $ sed -rf script.sed file
  33. INSERT INTO radcheck(id, username, attribute, op, value) VALUES (,'','00:23:32:c2:a9:e8','Auth-Type',':=','Accept');
  34.  
  35. sed -E -e "s/,([^ ),]+)/,'1'/g" -e "s/,,/,'',/g" file
  36.  
  37. $ cat file3
  38. INSERT INTO radcheck(username, attribute, op, value) VALUES (00:23:32:c2:a9:e8,'Auth-Type',':=','Accept');
  39.  
  40. $ sed -r "s/(([[:xdigit:]:]+)/('1'/" file3
  41. INSERT INTO radcheck(username, attribute, op, value) VALUES ('00:23:32:c2:a9:e8','Auth-Type',':=','Accept');
  42.  
  43. sed "s/(([^)]*)[^,]*){0,1},([^,)]*)/1,'2'/g
  44. " <<IN
  45. INSERT INTO radcheck(id, username, attribute, op, value) VALUES (,,00:23:32:c2:a9:e8,Auth-Type,:=,Accept);
  46.  
  47. INSERT INTO radcheck(id, username, attribute, op, value) VALUES (,'','00:23:32:c2:a9:e8','Auth-Type',':=','Accept');
  48.  
  49. INSERT INTO radcheck(id, username, attribute, op, value) VALUES (,'','00:23:32:c2:a9:e8','Auth-Type',':=','Accept');INSERT INTO radcheck(id, username, attribute, op, value) VALUES (,'','00:23:32:c2:a9:e8','Auth-Type',':=','Accept');INSERT INTO radcheck(id, username, attribute, op, value) VALUES (,'','00:23:32:c2:a9:e8','Auth-Type',':=','Accept');
Add Comment
Please, Sign In to add comment