setup.src
Code
Copy
001import_code("/home/me/h/libs/list.src")
002import_code("/home/me/h/libs/disk.src")
003import_code("/home/me/h/libs/nmap.src") // exports Nmap, Service
004import_code("/home/me/h/libs/scan.src") // exports Scan
005import_code("/home/me/h/libs/json.src") // exports Json
006import_code("/home/me/h/src/rndIP.src") // exports rnd_ip
007import_code("/home/me/h/src/docDB.src") // exports DocDB
008import_code("/home/me/h/libs/passwords.src")
009import_code("/home/me/h/src/machine.src") // exports Machine, MachineService, depends on Scan, Nmap	, Json, DocDB
010import_code("/home/me/h/src/shell.src") // extend map
011
012get_import_paths = function(code)
013	lines = code.split(char(10))
014
015	r = []
016	for l in lines
017		if l.indexOf("import_code" + "(""") != null then r.push(l.split("""")[1])
018	end for
019
020	return r
021end function
022
023check_sum_source = function(code)
024	comp = get_shell.host_computer
025	codes = [code]
026	
027	for s in get_import_paths(code)
028		codes.push comp.File(s).get_content
029	end for
030	
031	return md5(codes.join(""))
032end function
033
034comp = get_shell.host_computer
035
036print "setup hacking script"
037comp.File("/home/me/h/src/tableAttack.src").copy(home_dir + "/Config", "tableAttack.src")
038comp.File("/home/me/h/src/rserverInstaller.src").copy(home_dir + "/Config", "rserverInstaller.src")
039//get_shell.host_computer.touch(home_dir + "/Config", "emptyLog")
040
041print "compiling cli tools"
042comp.create_folder(home_dir, "vegaTools")
043
044while true
045	comp.touch(home_dir, ".vega_watch")
046	watch_file = comp.File(home_dir + "/.vega_watch")
047
048	watch_data = {}
049	f = function(o)
050		return o.split("=")
051	end function
052	if watch_file.get_content.len > 1 then watch_data = watch_file.get_content.split(char(10)).map(@f).to_map
053
054	for f in comp.File("/home/me/h/cli").get_files
055		if watch_data.hasIndex(f.name) == false then watch_data[f.name] = check_sum_source(f.get_content)
056	
057		compiled_script = comp.File(home_dir + "/vegaTools/" + f.name[:-4])
058
059		if watch_data[f.name] != check_sum_source(f.get_content) or compiled_script == null then
060			print "compiling " + f.name
061			f.copy(home_dir + "/vegaTools", f.name)
062			b = get_shell.build(home_dir + "/vegaTools/" + f.name, home_dir + "/vegaTools")
063			if b.len > 0 then print(f.name + " error: <color=red>" + b + "</color>")
064			comp.File(home_dir + "/vegaTools/" + f.name).delete
065			watch_data[f.name] = check_sum_source(f.get_content)
066		end if
067	end for
068
069	f = function(o)
070		return o[0] + "=" + o[1]
071	end function
072	watch_file.set_content watch_data.to_list.map(@f).join(char(10))
073
074	if params.hasIndex(0) == false or params[0] != "-w" then break
075end while
076
077// get bounce vulnerable router lib
078print("getting bounce vulnerable router lib")
079Machine.metaxploit = include_lib("/lib/metaxploit.so")
080Scan.metaxploit = include_lib("/lib/metaxploit.so")
081if comp.File(home_dir + "/Config/routerBouncerLib/kernel_router.so") == null then
082	while true
083		machine = new Machine
084		machine.init(rnd_ip)
085		machine.router_service.set_exploits
086		
087		shell = machine.router_service.quick_root_shell
088		
089		if typeof(shell) != "shell" then continue
090		
091		if machine.router_service.get_bounce_exploits.len > 0 then	
092			get_shell.host_computer.create_folder(home_dir + "/Config", "routerBouncerLib")
093			shell.scp("/lib/kernel_router.so", home_dir + "/Config/routerBouncerLib", get_shell)
094			break
095		end if
096	end while
097end if
098
099Disk.init(home_dir + "/Config", "passwords")
100
101// setup passwords db
102if Disk.read_chars.len > 0 then exit
103
104if(Disk.blobs.len > 1) then exit("password generation setup already completed")
105
106PasswordGenerator.init(PASSWORDS)
107print "generating passwords, it will take a while"
108HASH_TABLE=PasswordGenerator.AllPasswords
109print "done"
110
111print "parsing passwords obj"
112f = function(o)
113	return o[1]
114end function
115pass_list = HASH_TABLE.to_list.map(@f)	
116print "done"
117
118print "writing to disk"
119Disk.write(pass_list.join(char(10)))
120print "done"