Advertisement
Guest User

Automatic AP

a guest
Dec 19th, 2010
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.08 KB | None | 0 0
  1. ##  Autore: greyfox
  2. ##  Sviluppo: Beta
  3.  
  4.  
  5. ##  Programmi richiesti:
  6. ##  1) airmon-ng
  7. ##  2) airbase-ng
  8.  
  9. import os
  10.  
  11. ## Modifica file DNS
  12.  
  13. dnsfile = open('/etc/dhcp3/dhcpd.conf','w')
  14. dnsfile.write('ddns-update-style ad-hoc;\n')
  15. dnsfile.write('default-lease-time 600;\n')
  16. dnsfile.write('max-lease-time 7200;\n')
  17. dnsfile.write('subnet 192.168.2.128 netmask 255.255.255.128 {\n')
  18. dnsfile.write('option subnet-mask 255.255.255.128;\n')
  19. dnsfile.write('option broadcast-address 192.168.2.255;\n')
  20. dnsfile.write('option routers 192.168.2.129;\n')
  21. dnsfile.write('option domain-name-servers 4.2.2.2;\n')
  22. dnsfile.write('range 192.168.2.130 192.168.2.140;}\n')
  23. dnsfile.close()
  24.  
  25. ## Inserimento dati canale
  26.  
  27. channel_name = raw_input('Inserisci il nome del canale:')
  28. channel_number = raw_input('Inserisci il numero del canale:')
  29.  
  30. ## Impostazione base airmon-airbase
  31.  
  32. cmd_airbase = "airbase-ng -e"+channel_name+" -c"+channel_number+" mon0"
  33. airmon_start = os.popen('airmon-ng')
  34. airmon_start = os.popen('airmon-ng start wlan0')
  35. airbase = os.popen(cmd_airbase)
  36. airbase = os.popen(cmd_airbase)
  37.  
  38. ## Impostazione base ifconfig
  39.  
  40. ifconfig = os.popen('ifconfig at0 up')
  41. ifconfig = os.popen('ifconfig at0 192.168.2.129 netmask 255.255.255.128')
  42. ifconfig = os.popen('route add -net 192.168.2.128 netmask 255.255.255.128 gw 192.168.2.129')
  43.  
  44. ## Start DHCP
  45.  
  46. dhcp_start = os.popen('mkdir -p /var/run/dhcpd && chown dhcpd:dhcpd /var/run/dhcpd')
  47. dhcp_start = os.popen('dhcpd3 -cf /etc/dhcp3/dhcpd.conf -pf /var/run/dhcpd/dhcpd.pid at0')
  48.  
  49. ## Configurazione e impostazione IPTABLES
  50.  
  51. iptables = os.popen('iptables --flush')
  52. iptables = os.popen('iptables --table nat --flush')
  53. iptables = os.popen('iptables --delete-chain')
  54. iptables = os.popen('iptables --table nat --delete-chain')
  55. iptables = os.popen('echo 1 > /proc/sys/net/ipv4/ip_forward')
  56. iptables = os.popen('iptables --table nat --append POSTROUTING --out-interface wlan1 -j MASQUERADE')
  57. iptables = os.popen('iptables --append FORWARD --in-interface at0 -j ACCEPT')
  58. iptables = os.popen('iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to 192.168.1.1')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement