Guest User

Untitled

a guest
Mar 30th, 2020
126
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # ips.txt
  2. '''
  3. adr1;ip1;adr2;ip2
  4. adres1;192.168.1.1;adres6;192.168.1.6
  5. adres2;192.168.1.2;adres7;192.168.1.7
  6. adres3;192.168.1.3;adres8;192.168.1.8
  7. adres4;192.168.1.4;adres9;192.168.1.9
  8. adres5;192.168.1.5;adres10;192.168.1.10
  9. '''
  10.  
  11.  
  12. x = []
  13. with open('ips.txt', 'r', encoding='utf-8') as f:
  14.     next(f) # пропускаем заголовки
  15.     for s in f:
  16.         x.append(s.strip().split(';'))
  17.  
  18. with open('output_ips.txt', 'w', encoding='utf-8') as f2:
  19.     for s in x:
  20.         f2.write('#RDP доступ {} - {}\n'.format(s[0], s[2]))
  21.         f2.write('iptables -A FORWARD -p tcp -s {} -d {} —dport 3389 -j ACCEPT\n'.format(s[1], s[3]))
  22.         f2.write('iptables -A FORWARD -p tcp -s {} -d {} —dport 3389 -j ACCEPT\n'.format(s[3], s[1]))
  23.         f2.write('#RDP доступ {} - {}\n'.format(s[2], s[0]))
  24.         f2.write('iptables -A FORWARD -p tcp -s {} -d {} —dport 3389 -j ACCEPT\n'.format(s[3], s[1]))
  25.         f2.write('iptables -A FORWARD -p tcp -s {} -d {} —dport 3389 -j ACCEPT\n'.format(s[1], s[3]))
  26.  
  27.  
  28. # output_ips.txt
  29. '''
  30. #RDP доступ adres1 - adres6
  31. iptables -A FORWARD -p tcp -s 192.168.1.1 -d 192.168.1.6 —dport 3389 -j ACCEPT
  32. iptables -A FORWARD -p tcp -s 192.168.1.6 -d 192.168.1.1 —dport 3389 -j ACCEPT
  33. #RDP доступ adres6 - adres1
  34. iptables -A FORWARD -p tcp -s 192.168.1.6 -d 192.168.1.1 —dport 3389 -j ACCEPT
  35. iptables -A FORWARD -p tcp -s 192.168.1.1 -d 192.168.1.6 —dport 3389 -j ACCEPT
  36. #RDP доступ adres2 - adres7
  37. iptables -A FORWARD -p tcp -s 192.168.1.2 -d 192.168.1.7 —dport 3389 -j ACCEPT
  38. iptables -A FORWARD -p tcp -s 192.168.1.7 -d 192.168.1.2 —dport 3389 -j ACCEPT
  39. #RDP доступ adres7 - adres2
  40. iptables -A FORWARD -p tcp -s 192.168.1.7 -d 192.168.1.2 —dport 3389 -j ACCEPT
  41. iptables -A FORWARD -p tcp -s 192.168.1.2 -d 192.168.1.7 —dport 3389 -j ACCEPT
  42. #RDP доступ adres3 - adres8
  43. iptables -A FORWARD -p tcp -s 192.168.1.3 -d 192.168.1.8 —dport 3389 -j ACCEPT
  44. iptables -A FORWARD -p tcp -s 192.168.1.8 -d 192.168.1.3 —dport 3389 -j ACCEPT
  45. #RDP доступ adres8 - adres3
  46. iptables -A FORWARD -p tcp -s 192.168.1.8 -d 192.168.1.3 —dport 3389 -j ACCEPT
  47. iptables -A FORWARD -p tcp -s 192.168.1.3 -d 192.168.1.8 —dport 3389 -j ACCEPT
  48. #RDP доступ adres4 - adres9
  49. iptables -A FORWARD -p tcp -s 192.168.1.4 -d 192.168.1.9 —dport 3389 -j ACCEPT
  50. iptables -A FORWARD -p tcp -s 192.168.1.9 -d 192.168.1.4 —dport 3389 -j ACCEPT
  51. #RDP доступ adres9 - adres4
  52. iptables -A FORWARD -p tcp -s 192.168.1.9 -d 192.168.1.4 —dport 3389 -j ACCEPT
  53. iptables -A FORWARD -p tcp -s 192.168.1.4 -d 192.168.1.9 —dport 3389 -j ACCEPT
  54. #RDP доступ adres5 - adres10
  55. iptables -A FORWARD -p tcp -s 192.168.1.5 -d 192.168.1.10 —dport 3389 -j ACCEPT
  56. iptables -A FORWARD -p tcp -s 192.168.1.10 -d 192.168.1.5 —dport 3389 -j ACCEPT
  57. #RDP доступ adres10 - adres5
  58. iptables -A FORWARD -p tcp -s 192.168.1.10 -d 192.168.1.5 —dport 3389 -j ACCEPT
  59. iptables -A FORWARD -p tcp -s 192.168.1.5 -d 192.168.1.10 —dport 3389 -j ACCEPT
  60. '''
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×