diff options
Diffstat (limited to 'kpov_judge/tasks/openvpn_simple_smb')
-rw-r--r-- | kpov_judge/tasks/openvpn_simple_smb/task.py | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/kpov_judge/tasks/openvpn_simple_smb/task.py b/kpov_judge/tasks/openvpn_simple_smb/task.py index 4ac5f76..86fba69 100644 --- a/kpov_judge/tasks/openvpn_simple_smb/task.py +++ b/kpov_judge/tasks/openvpn_simple_smb/task.py @@ -223,11 +223,44 @@ def task(IP_SimpleArbiterVPN, DNS_SimpleArbiterVPN, IP_VPNClient1, DNS_VPNClient output = sA.before results['SimpleArbiter_ping_C2'] = output - # TODO + ### # Check if both clients are connected to the correct VPN # (check if first 24 bits of IP addr are the same as the server's) - #sB.sendline('sudo apt-get install nmap --assume-yes') - #sB.sendline('sudo nmap -sP 10.8.0.0/24') + # a.k.a. the YES WE CAN method of checking things + # really, really hoping it has root privileges too + ### + ### Install nmap + # Check if root + sA.sendline('id -u') + sA.prompt() + uid = sA.before.split('\n') + uid = uid[1].rstrip() + #print uid + # If is isn't root + if ( uid != "0" ): + print "SimpleArbiter user must be root to continue with this step (installing nmap mostly)" + # If it is, we continue + else: + ### Install the nmap package + # Check if nmap is already installed + sA.sendline('dpkg-query -W nmap') + sA.prompt() + lines = sA.before.split('\n') + line = lines[1] + # If it isn't + if ( len(line.rstrip()) == 4 ): # returns "nmap\r\n" if package isn't installed + sA.sendline('apt-get install nmap --assume-yes') + # If it is + else: + sA.sendline('') + #sA.wait() # For some reason this hangs + sA.expect(".*#") # Expecting a new line prompt (root's prompt ends with a #) + + # Run nmap on the VPN network + sA.sendline('nmap -sP 10.8.0.0/24') + sA.prompt() + results['SimpleArbiter_nmap_results'] = sA.before + ###### |