Skip to content

Instantly share code, notes, and snippets.

@rnek0
Last active March 30, 2024 20:42
Show Gist options
  • Save rnek0/5637714c2ae9a57d39abd2e6b695c8ce to your computer and use it in GitHub Desktop.
Save rnek0/5637714c2ae9a57d39abd2e6b695c8ce to your computer and use it in GitHub Desktop.

Set target & Clear target

Il s'agit des deux scripts prévus pour la barre de droite pour avoir l'ip et le nom de la machine.

settarget {ip} {nomMachine}

ex : settarget 10.129.110.17 Vaccine

cleartarget efface les infos

Voir dans le .zshrc

❯ less .zshrc | grep settarget -A4
function settarget(){
    ip_address=$1
    machine_name=$2
    echo "$ip_address $machine_name" > /home/rnek0/.config/bin/target.txt
}
❯ less .zshrc | grep cleartarget -A2
function cleartarget(){
    echo '' > /home/rnek0/.config/bin/target.txt
}

Je veux que settarget me genere l'environnement de travail en meme temps :

function settarget(){
    ip_address=$1
    machine_name=$2
    echo "$ip_address $machine_name" > /home/rnek0/.config/bin/target.txt
    
    mkdir -p "/home/rnek0/hackers/htb/machines/$machine_name"
    echo "$machine_name" >> /home/rnek0/hackers/htb/machines/machines.txt

    cd  "/home/rnek0/hackers/htb/machines/$(tail -n1 /home/rnek0/hackers/htb/machines/machines.txt)"
    mkt()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment