# Network-Scout - An Addition to Artillery # # An artillery logging and web interface # # By Shawn Jordan and Aedan Somerville # # Special thanks to Dave Kennedy, DOW Chemical Co., Marshall University # # Adafruit, Jusbour and the Open Source Community # # Version 2.0 "THUNDERING HERD" # ################################# GO HERD ####################################### ################################################################################# #!/usr/bin/python from source import core import sys, os, subprocess, time #Starting Client side programs server = core.read_config("IP_SERVER_ADDRESS") # check if its installed (from Artillery) if not os.path.isfile("/var/networkscout/nsclient.py"): print "[*] Network Scout is not installed, running setup.py.." subprocess.Popen("python network_scout_setup.py", shell=True).wait() sys.exit() else: while True: log_size = os.stat("/var/artillery/log/logs.txt").st_size if log_size < 10: pass else: try: #Function sends the information to the server defined in the CONFIG file
s.listen(4) (conn, (ip, port)) = s.accept() data = conn.recv(2048) #RECEIVE DATA FROM TCP CONNECTION dfile = open("/var/networkscout/stuff/recievedinfo", "w") dfile.write( (data) ) dfile.close() #send back command/message conn.send("You're message has been recieved.") conn.close() s.close() ##SETS MYSQL OR FILE CREATION rpi = core.read_config("IS_R_PI") if rpi == "NO": log_size = os.stat("/var/networkscout/stuff/recievedinfo").st_size if log_size < 1: pass else: #LOOP OVER THE FILE TO READ ALL THE LINES of_object = open("/var/networkscout/stuff/recievedinfo", "r") webinfo = open("/var/networkscout/stuff/webinfo","a") webinfo.write(of_object) flag = 0 #checks to ensure all data is in database if flag is 1: pass
s.listen(4) (conn, (ip, port)) = s.accept() data = conn.recv(2048) #RECEIVE DATA FROM TCP CONNECTION dfile = open("/var/networkscout/stuff/recievedinfo", "w") dfile.write((data)) dfile.close() #send back command/message conn.send("You're message has been recieved.") conn.close() s.close() ##SETS MYSQL OR FILE CREATION rpi = core.read_config("IS_R_PI") if rpi == "NO": log_size = os.stat("/var/networkscout/stuff/recievedinfo").st_size if log_size < 1: pass else: #LOOP OVER THE FILE TO READ ALL THE LINES of_object = open("/var/networkscout/stuff/recievedinfo", "r") webinfo = open("/var/networkscout/stuff/webinfo", "a") webinfo.write(of_object) flag = 0 #checks to ensure all data is in database if flag is 1: pass