[First commit]

- Create git structure
- Adding scripts, tools and classes already written
This commit is contained in:
xoy 2023-12-31 16:55:13 +01:00
commit 3b58a05e5e
7 changed files with 134 additions and 0 deletions

17
Classes/README.MD Normal file
View File

@ -0,0 +1,17 @@
# Classes
## [nmap](https://git.ctdo.de/xoy/xoy_greyhack_src/src/branch/main/Classes/nmap.src)
The default nmap script as a class.
### Functions
#### scan
- Arguments: *ipAddress*
- Description: *scan an ip address for ports and return the data as an object.*
#### print
- Arguments: *data*
- Decription: *printing the data object got by the **scan** function.*

59
Classes/nmap.src Normal file
View File

@ -0,0 +1,59 @@
NMAP = {}
NMAP.scan = function( ipAddress )
if is_valid_ip( ipAddress ) and get_shell.host_computer.is_network_active then
DATA = {}
DATA.dateOfScan = current_date
DATA.ipAddress = ipAddress
DATA.isLanIp = is_lan_ip( DATA.ipAddress )
//check if ipAddress is local and set the router var
if DATA.isLanIp then DATA.router = get_router else DATA.router = get_router( ipAddress )
//break and return false if the ip address was not found
if DATA.router == null then return false
//define raw port list var
raw_ports = null
//check if local and set raw port list
if not DATA.isLanIp then raw_ports = DATA.router.used_ports else raw_ports = DATA.router.device_ports(DATA.ipAddress)
//break and return false if the ip address was not found
if raw_ports == null then return false
//define port list var
DATA.ports = []
//fill port list
for port in raw_ports
serviceInfo = DATA.router.port_info(port)
lanIp = port.get_lan_ip
if port.is_closed and not DATA.isLanIp then portStatus = "open" else portStatus = "closed"
INFO = {
"portNumber": port.port_number,
"serviceInfo": serviceInfo,
"lanIp": lanIp,
"status": portStatus}
DATA.ports = DATA.ports + [INFO]
end for
return DATA
else
return false
end if
end function
NMAP.print = function( data )
info = "PORT STATE SERVICE VERSION LAN"
print("\nPrinting nmap scan from " + data.dateOfScan)
print("Interesting ports on " + data.ipAddress + "\n")
if data.ports.len == 0 then
print("No open ports.")
else
for port in data.ports
info = info + "\n" + port.portNumber + " " + port.status + " " + port.serviceInfo + " " + port.lanIp
end for
print(format_columns(info) + "\n")
end if
end function

13
README.MD Normal file
View File

@ -0,0 +1,13 @@
# xoy grey hack sources
## [Scripts](https://git.ctdo.de/xoy/xoy_greyhack_src/src/branch/main/Scripts)
Little scipts that do stuff without additional sources.
## [Tools](https://git.ctdo.de/xoy/xoy_greyhack_src/src/branch/main/Tools)
Scripts that require additional sources.
## [Classes](https://git.ctdo.de/xoy/xoy_greyhack_src/src/branch/main/Classes)
Classes for the tools.

12
Scripts/BeRightBack.src Normal file
View File

@ -0,0 +1,12 @@
message = "be right back"
i = 1
while(true)
clear_screen
print message + "." * i
wait(0.5)
if i < 3 then
i = i + 1
else
i = 1
end if
end while

5
Scripts/README.MD Normal file
View File

@ -0,0 +1,5 @@
# Scripts
## [BeRightBack](https://git.ctdo.de/xoy/xoy_greyhack_src/src/branch/main/Scripts/BeRightBack.src)
Just a hello world thingy.

11
Tools/README.MD Normal file
View File

@ -0,0 +1,11 @@
# Tools
## [ipinfo](https://git.ctdo.de/xoy/xoy_greyhack_src/src/branch/main/Tools/ipinfo.src)
Get information about an ip address.
Usage: *ipinfo [ip address]*
### Requirements
- [nmap](https://git.ctdo.de/xoy/xoy_greyhack_src/src/branch/main/Classes/nmap.src)

17
Tools/ipinfo.src Normal file
View File

@ -0,0 +1,17 @@
if params.len != 1 or params[0] == "-h" or params[0] == "--help" then exit("Usage: ipinfo [ip address]\nExample: ipinfo 127.0.0.1")
if not is_valid_ip(params[0]) then exit("ipinfo: invalid ip address")
if not get_shell.host_computer.is_network_active then exit("ipinfo: No internet access.")
ipAddress = params[0]
import_code("/src/nmap.src")
admin = null
if not is_lan_ip(ipAddress) then admin = whois(ipAddress)
data = NMAP.scan(ipAddress)
if data == false then exit("Error while scanning (check the ip address)!")
if not admin == null then print(admin) else print("No admin data on local addresses!")
NMAP.print(data)