Browse Source

some more functions

Marius Schwarz 5 years ago
parent
commit
314110b2b2
1 changed files with 49 additions and 15 deletions
  1. 49 15
      shell-plug.sh

+ 49 - 15
shell-plug.sh

@@ -7,37 +7,71 @@
 
 # base variables
 WORDLIST_PATH="$HOME/documents/tools/lists"
-
+PROJ_FILE=$HOME/.pentest_proj
+IP_FILE=$HOME/.pentest_target
 
 function pentest {
     echo "Pentest Shortuts Plugins"
     echo "[*] Aliases: "
-    echo "    pentest: display help for the commands and shortcuts"
+    echo "    pentest     : display help for the commands and shortcuts"
     echo ""
     echo "[*] Env. Variables: "
-    echo "    ROCKYOU: $ROCKYOU"
-    echo "    WLIST_DIRS: $WLIST_DIRS"
-    echo "    WLIST_FILES: $WLIST_FILES"
-    echo "[*] Functions"
-    echo "    set_ip <ip>: set global env variable \$IP/\$ip to <ip>"
-    echo "    get_ip: prints \$ip"
+    echo "    ROCKYOU     : $ROCKYOU"
+    echo "    WLIST_DIRS  : $WLIST_DIRS"
+    echo "    WLIST_FILES : $WLIST_FILES"
+    echo ""
+    echo "[*] Functions:"
+    echo "    set_ip <ip> : set global env variable \$IP to <ip>"
+    echo "    get_ip      : prints \$ip"
+    echo "    set_proj    : set global env variable \$P to the current path"
+    echo "    get_proj    : prints \$P"
+    echo ""
+    echo "[*] Set Configuration:"
+    echo "    \$Target    : $IP"
+    echo "    \$Proj. Path: $P"
 }
 
 function set_ip {
     if [ "$1" != "" ]; then
         echo "[*] Setting IP to $1"
-        echo "$1" > $HOME/.pentest_target
+        echo "$1" > $IP_FILE
         # export the scope IP as global variable
-        export ip=$(cat $HOME/.pentest_target)
-        export IP=$ip
+        export IP=$(cat $IP_FILE)
     fi
 }
 
+function set_proj {
+    echo "[*] Setting Project Path to $(pwd)"
+    echo "$(pwd)" > $PROJ_FILE
+    # export the scope IP as global variable
+    export P=$(cat $PROJ_FILE)
+}
+
+function get_proj {
+    echo $P
+}
+
 function get_ip {
     # print the ip, for using this function
-    echo $ip
+    echo $IP
 }
 
-export ROCKYOU=$WORDLIST_PATH/SecLists/Discovery/Web-Content/raft-medium-directories.txt
-export WLIST_DIRS=$WORDLIST_PATH/SecLists/Discovery/Web-Content/raft-medium-directories.txt
-export WLIST_FILES=$WORDLIST_PATH/SecLists/Discovery/Web-Content/raft-medium-files.txt
+function init {
+    # autoload target IP into $IP
+    if [ -f $IP_FILE ]; then
+        export IP=$(cat $IP_FILE)
+    fi
+
+    # autoload project path into $P
+    if [ -f $PROJ_FILE ]; then
+        export P=$(cat $PROJ_FILE)
+    fi
+    # Wordlist bindings
+    export ROCKYOU=$WORDLIST_PATH/SecLists/Discovery/Web-Content/raft-medium-directories.txt
+    export WLIST_DIRS=$WORDLIST_PATH/SecLists/Discovery/Web-Content/raft-medium-directories.txt
+    export WLIST_FILES=$WORDLIST_PATH/SecLists/Discovery/Web-Content/raft-medium-files.txt
+}
+
+
+# call init() function
+init