Files
cli/libfish.src
- import_code("/home/me/h/src/utils.src") // exports map.inspect, p
- import_code("/home/me/h/libs/list.src") // exports list utils and map utils
- import_code("/home/me/h/libs/disk.src") // exports Disk, Block
- import_code("/home/me/h/libs/nmap.src") // exports Nmap, Service
- import_code("/home/me/h/libs/scan.src") // exports Scan
- import_code("/home/me/h/libs/json.src") // exports Json
- import_code("/home/me/h/src/rndIP.src") // exports rnd_ip
- import_code("/home/me/h/src/docDB.src") // exports DocDB
- import_code("/home/me/h/src/machine.src") // exports Machine, MachineService, depends on Scan, Nmap , Json, DocDB
- import_code("/home/me/h/libs/meta.src") // exports Meta
- import_code("/home/me/h/src/shell.src") // extend map
- get_shell.host_computer.create_folder(home_dir + "/Config", "libs")
- LIB_STORE_PATH = home_dir + "/Config/libs"
- Machine.metaxploit = include_lib("/lib/metaxploit.so")
- Scan.metaxploit = include_lib("/lib/metaxploit.so")
- Command = {}
- Command.libfish_sig = {}
- Command.libfish_sig["description"] = "hack random npcs to find libs"
- lib_param_desc = []
- lib_param_desc.push "libs to search for, if this param is present the command will only search for the specific libs passed "
- lib_param_desc.push "but you can pass as many lib names as you want, the valid params are: "
- lib_param_desc.push Service.remote_lib_dict.indexes.join(", ")
- lib_param_desc = lib_param_desc.join("")
- Command.libfish_sig["args"] = [["lib", lib_param_desc]]
- Command.libfish_sig["options"] = [{["-l", "--search-local-libs"]: "save local libs aswell"}]
- Command.libfish = function(args = [], options = {})
- if args.len > 0 then
- for arg in args
- if Service.remote_lib_dict.hasIndex(arg) == 0 then exit("invalid param, look at the docs")
- end for
- for i in Service.remote_lib_dict.indexes
- if args.indexOf(i) == null then Service.remote_lib_dict.remove(i)
- end for
- end if
- while true
- machine = new Machine
- machine.init(rnd_ip)
-
- for s in machine.services
- known_libs = get_shell.host_computer.File(LIB_STORE_PATH).get_files
- for i in known_libs.indexes
- known_libs[i] = known_libs[i].name
- end for
-
- s.set_exploits
- key = s.info.replace(".", "").replace(" ", "")
-
- if options["-l"] == false then
- // skip service if not listed on libs
- if not Service.remote_lib_dict.hasIndex(s.info.split(" ")[0]) then continue
- // skip service if remote lib is already in store
- if known_libs.indexOf(key) then continue
- end if
- sh = s.quick_root_shell
- if typeof(sh) != "shell" then continue
- machine.save_exploits
-
- if Service.remote_lib_dict.hasIndex(s.info.split(" ")[0]) == true then
- if known_libs.indexOf(key) == null and key then
- so_name = Service.remote_lib_dict[s.info.split(" ")[0]]
- sh.scp("/lib/" + so_name, LIB_STORE_PATH, get_shell)
- get_shell.host_computer.File(LIB_STORE_PATH + "/" + so_name).rename(key)
- end if
- end if
-
- if options["-l"] == true then
- for i in Service.local_lib_dict.values
- if typeof(sh.host_computer.File("/lib/" + i)) != "file" then continue
-
- sh.scp("/lib/" + i, LIB_STORE_PATH, get_shell)
-
- lib = machine.metaxploit.load("/lib/" + i)
- key = Service.local_lib_dict.indexOf(i) + lib.version.replace(".", "")
-
- if known_libs.indexOf(key) then
- get_shell.host_computer.File(LIB_STORE_PATH + "/" + i).delete
- else
- get_shell.host_computer.File(LIB_STORE_PATH + "/" + i).rename(key)
- end if
- end for
- end if
sh.clear_logs
- end for
- end while
- end function
- import_code("/home/me/h/libs/thor.src") //depends on Listlib, exports Thor
- Thor.init(Command, "libfish")
cli/hack.src
- import_code("/home/me/h/src/utils.src") // exports map.inspect, p
- import_code("/home/me/h/libs/list.src") // exports list utils and map utils
- import_code("/home/me/h/libs/disk.src") // exports Disk, Block
- import_code("/home/me/h/libs/nmap.src") // exports Nmap, Service
- import_code("/home/me/h/libs/scan.src") // exports Scan
- import_code("/home/me/h/libs/json.src") // exports Json
- import_code("/home/me/h/src/rndIP.src") // exports rnd_ip
- import_code("/home/me/h/libs/optionSelector.src") // exports option_selector
- import_code("/home/me/h/src/docDB.src") // exports DocDB
- import_code("/home/me/h/src/machine.src") // exports Machine, MachineService, depends on Scan, Nmap , Json, DocDB
- import_code("/home/me/h/libs/meta.src") // exports Meta
- import_code("/home/me/h/src/shell.src") // extend map
- Machine.metaxploit = include_lib("/lib/metaxploit.so")
- Scan.metaxploit = include_lib("/lib/metaxploit.so")
- Command = {}
- Command.hack_sig = {}
- Command.hack_sig["description"] = "hack shit"
- Command.hack_sig["args"] = ["ip*"]
- Command.hack_sig["options"] = []
- Command.hack = function(args = [], options = {})
- machine = new Machine
- machine.init(args[0])
-
- services = machine.services
- f = function(o)
return [o, o.lan_ip + " " + o.info + " " + o.port]
- is_cached = "not cached"
- if machine.exploits_db.obj.hasIndex(o.info_to_key) then
- is_cached = "<color=green>cached</color>"
- end if
-
- return [o, o.lan_ip + ":" + o.port + " " + o.info + " " + is_cached]
- end function
- services = services.map(@f)
-
- print "target which lib?"
- service = user_select(services)
-
- service.set_exploits
-
- shell = null
print "do you want to auto root ? (only works on npcs)"
if user_select([[true, "yes"], [false, "no"]]) then
- if user_confirmation("do you want to auto root ? (only works on npcs)") then
- shell = service.quick_root_shell
- else
- for x in service.exploits
- x.set_result
- if typeof(x.result) == shell then shell = x.result
- end for
- end if
-
- if shell == null then
- exit("no shells")
- end if
-
- machine.save_exploits
print "do you want to clear the logs?"
if user_select([[true, "yes"], [false, "no"]]) then
- if user_confirmation("do you want to clear the logs") then
- shell.clear_logs
- end if
-
- shell.start_terminal
- end function
- import_code("/home/me/h/libs/thor.src") //depends on Listlib, exports Thor
- Thor.init(Command, "hack")
libs/optionSelector.src
- user_confirmation = function(prompt)
- while true
- options = {"Y": true, "N": false, "y": true, "n": false}
- selected = user_input(prompt + "? [Y/n]: ")
- if options.hasIndex(selected) == true then
- return options[selected]
- end if
- end while
- end function
- // expect a l(list) containing this structure [return_obj, display_text]
- user_select = function(m)
- while true
- for i in m.indexes
- print "[<color=yellow>" + i + "</color>] " + m[i][1]
- end for
- selected = user_input("select a option: ").to_int
- if selected isa string or m.hasIndex(selected) == false then
- print "<color=red>ERROR: invalid option, try again</color>"
- continue
- end if
- selected = m[selected]
- if selected[0] == "return" then return
- return selected[0]
- end while
- end function
- // DEPRACATED USE user_input
- // expect a l(list) containing this structure [func, params, display_text]
- // also instead of a func in the first param you can set the string "return" to make the function return instead
- option_selector = function(m)
- while true
- for i in m.indexes
- print "[<color=yellow>" + i + "</color>] " + m[i][2]
- end for
- selected = user_input("select a option: ").to_int
- if selected isa string or m.hasIndex(selected) == false then
- print "<color=red>ERROR: invalid option, try again</color>"
- continue
- end if
- selected = m[selected]
- if selected[0] == "return" then return
- selected[0](selected[1])
- return
- end while
- end function