Bash projects 0–100(part II)

Emmanuel Wiseman
4 min readFeb 21, 2025

--

Hi, and welcome to another instalment of this series, this time will be looking at a bash project that is more of a port scanner

#script 3 portradar

this script is apparently long…wizard if you seeing this thank you(cries) as i type i will split into different parts to understand what the sec engineer was thinking about

section 1: the help

yeah, i did that..makes sense anyway, like most great scripts..the help feature really does help if you get stuck or lost as you start to see what you are allowed to do by the script’s artist(yes this is art).

so according to some blog below in the references the usage can i call it a function, yeah the function shows you the correct commands syntax.

$0- an argument that denotes to the name of the script.

the rest are just options that you can use to run a scan

section 2: i have no idea

No seriously, i got no clue what to call this section…correction (i shall call it function simulators)the aritst told me in confidence..ok moving on

cl- clear , this function simulator is removing certain files..just don’t try this without adult supervision when it comes to a proc env(warned ya in advance)

pp-pretty print, this function simulator is…well i see a for loop with a length of 30, the echo argument stops a newline from forming at the end of the ouptut generated

pt — print table and my golly, this thing is taking up so much $codes, i am not for the life of me typing that down, I’ll just say those codes go from 100 to 6000 😂 the rest of the function, has a positional parameter, $1 with && operators to only run if true, also adding in some color where cg_color comes in and run nmap to return and sort the ports...yeah i think that's about it for this section.

section 3: scan away

in this part of the script it's just the scans the artist decided upon

tcp_scan- ret(i guess return in short), the name of the script, nc that is for nectat and the commands to scan tcp, so if successful echo the ports with a certain color.

udp_scan- ret(i guess return in short), the name of the script, nc that is for nectat and the commands (-u) is for udp, so if successful echo the ports

fast_ping- force and echo the ips

scan_tcp- a lot of arguments here, return, then the normal port scan but then now there is enumeration and saving to an nmap file the output

section 4: the end of scans

so far, this is the final part of this art, my gosh the artist has put through a for loop ngl….

yeah, there’s no point explaining the subnet area, it’s been explained really well by the artist, with if and else statements and for loops.

wait- this is the first time, i have seen this command, never saw that in the black-hat bash…this command literally waits for all background processes to finish before the script continues to run.

That was not easy but it was worth it to see the type of thinking i need to reach…next project, i want to try my hands on is more of a password generator(yep…database)

well, my mind is tired but het, that’s the game i signed up for..till next time

--

--

Emmanuel Wiseman
Emmanuel Wiseman

Written by Emmanuel Wiseman

Just someone sharing knowledge on his cyber journey

No responses yet