Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wintrmvte committed Jul 10, 2020
0 parents commit 75d37a9
Show file tree
Hide file tree
Showing 22 changed files with 552 additions and 0 deletions.
124 changes: 124 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<h1 align="center"> </h1> <br>

<p align="center">
<a>
<img alt="Netenum" title="Netenum" src="img/citadel.png">
</a>
</p>


![Language](https://img.shields.io/badge/Language-Python-blue.svg?longCache=true&style=flat-square) ![Language](https://img.shields.io/badge/Language-Bash-magenta.svg?longCache=true&style=flat-square)
![License](https://img.shields.io/badge/License-MIT-purple.svg?longCache=true&style=flat-square)

## Introduction
Citadel is a collection of various scripts that I wrote for use in pentesting-related tasks (but not only, some general purpose code chunks are also present here ;> ).


## List of scripts included
- [vars.zsh](#vars.zsh)
- [msf\_resource\_scripts](#msf_resource_scripts)
- [dnsdump.py](#dnsdump.py)
- [fileinfo.zsh](#fileinfo.zsh)
- [fileserver.py](#fileserver.py)
- [opcodes.zsh](#opcodes.zsh)
- [stackpush.zsh](#stackpush.zsh)
- [ssl_convert.zsh](#ssl_convert.zsh)
- [gitdownload.zsh](#gitdownload.zsh)





<br>
### vars.zsh
<p align="center">
<a>
<img src="img/vars_screen.png">
</a>
</p>
Exports useful networking variables that can be used directly in terminal.

<br>
### msf\_resource\_scripts
<p align="center">
<a>
<img src="img/msfscripts_screen.png">
</a>
</p>
This directory contains a few `.rc` files for Metasploit Framework Console that automate certain tasks in the CLI. In order for them to work properly, put all scripts from this directory into your default path containing resource scripts for the framework, then load the main file: `msf5> resource main.rc`.


<br>
### dnsdump.py
<p align="center">
<a>
<img src="img/dnsdump_screen.png">
</a>
</p>

Downloads an image representation of DNS graph from [dnsdump.com](http://dnsdump.com).

<br>
### fileinfo.zsh
<p align="center">
<a>
<img src="img/fileinfo_screen.png">
</a>
</p>

Presents basic information about selected file.

<br>
### fileserver.py
<p align="center">
<a>
<img src="img/fileserver_screen.png">
</a>
</p>

Simple file server that exposes a local directory.

<br>
### opcodes.zsh
<p align="center">
<a>
<img src="img/opcodes_screen.png">
</a>
</p>
Extracts opcodes from a binary, and prints them to STDOUT. Useful in shellcode development.

<br>
### stackpush.zsh
<p align="center">
<a>
<img src="img/stackpush_screen.png">
</a>
</p>
Generates assembly instructions that push desired string onto the stack.

<br>
### ssl_convert.zsh
<p align="center">
<a>
<img src="img/sslconvert_screen.png">
</a>
</p>
Performs common OpenSSL file conversions.

<br>
### gitdownload.zsh
<p align="center">
<a>
<img src="img/gitdownload_screen.png">
</a>
</p>
Downloads a single file from a Github repository.





## License
This software is under [MIT License](https://en.wikipedia.org/wiki/MIT_License)


27 changes: 27 additions & 0 deletions dnsdump.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/python3.7
import argparse
import requests
import shutil

def arguments():
parser = argparse.ArgumentParser(prog="dnsdump")
parser.add_argument("DOMAIN", help="Domain to query")
parser.add_argument("OUTFILE", nargs="?", help="Name of the image file to save (default: <domain>_dnsdump.jpg)")
return parser.parse_args()

def main():
res = arguments()
url = f"https://dnsdumpster.com/static/map/{res.DOMAIN}.png"
image_filename = res.DOMAIN.split(".")[0]+"_dnsdump.png"
if res.OUTFILE:
image_filename = res.OUTFILE
r = requests.get(url, stream=True)
if r.status_code == 200:
with open(image_filename, "wb") as f:
r.raw.decode_content = True
shutil.copyfileobj(r.raw, f)
f.close()
print(f"[*] Saved {res.DOMAIN} DNS dump in {image_filename}")

if __name__ == "__main__":
main()
57 changes: 57 additions & 0 deletions fileinfo.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/zsh
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
blue=`tput setaf 4`
magenta=`tput setaf 5`
grey=`tput setaf 8`
reset=`tput sgr0`
bold=`tput bold`
underline=`tput smul`

print_good(){
echo "${green}[+]${reset}" $1
}

print_error(){
echo "${red}[x]${reset}" $1
}

print_info(){
echo "[*]" $1
}

print_warning(){
echo "${yellow}[!]${reset}" $1
}

if [[ "$@" =~ .*-h.* ]]; then
echo "Usage:"
echo "\tfileinfo file"
echo "Description:"
echo "\tShow general information about a file"
echo "Arguments:"
echo "\tfile - file to inspect"
return
fi
file=$1
if [ $# -eq 0 ]; then
print_error "Specify file"
return
fi
if [ $? -eq 1 ]; then
return
fi
if [[ -x "$file" ]]; then
executable="${green}yes${reset}"
else
executable="${red}no${reset}"
fi
echo "
${green}*${reset}NAME: $file
${green}*${reset}CREATION DATE: $(stat -c %y $file| sed 's/^\([0-9\-]*\).*/\1/')
${green}*${reset}PERMISSIONS: $(stat -c "%a" $file)
${green}*${reset}SIZE: $(numfmt --to=iec-i --suffix=B --format="%.3f" $(stat --printf="%s" $file))
${green}*${reset}EXECUTABLE: ${executable}
${green}*${reset}ENCODING: $(file -bi $file)
"
35 changes: 35 additions & 0 deletions fileserver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/python3.7
import argparse
from bottle import static_file, route, run
import os.path

def arguments():
parser = argparse.ArgumentParser()
parser.add_argument('DIR', help="Directory to host")
parser.add_argument('-d', '--debug', dest='DEBUG', help="Print debug messages")
parser.add_argument('-p', '--port', action="store",
default=8080,
type=int, metavar="<port>", dest='PORT',
help="Port to run server on (default: 8080)")
parser.add_argument('-bp', '--base-path', action="store",
metavar="<path>", dest='BASEPATH',
help="Base path of server's files (http://<ip>/<basepath>/<file>) (default: DIR)")
return parser.parse_args()

def main():
res = arguments()
if res.BASEPATH:
basepath = res.BASEPATH
else:
basepath = res.DIR
@route('<filename>')
def serve(filename):
return static_file(filename, root=res.DIR)
#if res.RUN_LOCALLY:
# host = "localhost"
#else:
# host = ""
run(host="0.0.0.0", port=res.PORT, debug=res.DEBUG)

if __name__ == "__main__":
main()
48 changes: 48 additions & 0 deletions gitdownload.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/zsh

red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
blue=`tput setaf 4`
magenta=`tput setaf 5`
grey=`tput setaf 8`
reset=`tput sgr0`
bold=`tput bold`
underline=`tput smul`


print_good(){
echo "${green}[+]${reset}" $1
}
print_error(){
echo "${red}[x]${reset}" $1
}
print_info(){
echo "[*]" $1
}

if [[ "$@" =~ .*-h.* ]]; then
echo "Usage:"
echo "\tgitdownload USERNAME REPOSITORY FILE"
echo "Description:"
echo "\tDownload a single file from a Github repository"
echo "Arguments:"
echo "\tusername - user that owns the repository"
echo "\trepository - name of the repository"
echo "\tfile - file to download"
return
else
if [ $# -eq 0 ]; then
print_error "Specify the USER"
elif [ $# -eq 1 ]; then
print_error "Specify the REPO"
elif [ $# -eq 2 ]; then
print_error "Specify the FILE"
else
user=$1
repo=$2
file=$3
curl -LJO https://github.com/$user/$repo/raw/master/$file
print_good "Downloaded $file ($(wc -c < $file) bytes)"
fi
fi
Binary file added img/citadel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/dnsdump_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/fileinfo_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/fileserver_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/gitdownload_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/msfscripts_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/opcodes_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/sslconvert_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/stackpush_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/vars_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions msf_resource_scripts/all_post.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<ruby>
selected_sessions = framework.datastore["SESSIONS"].split(",")
background_run = ""
if framework.datastore["BG"] == "true"
background_run = "-j"
end
selected_sessions.each do |num,session|
run_single("set session #{num}")
print_status("Running #{active_module.fullname} against session #{num}")
run_single("run #{background_run}")
end
</ruby>
18 changes: 18 additions & 0 deletions msf_resource_scripts/main.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
clear
color true
load alias
load post
alias -f x resource msf_rc/all_post.rc
alias -f sg setg
alias si sessions -i
alias sk sessions -K
alias sl sessions -v
alias i resource msf_rc/show_all_info.rc
alias c clear
alias u use
alias -f r run
alias j jobs -v
alias jk jobs -k
alias rc resource
alias adv advanced
set PROMPT [%redsessions:%whi%S %blujobs:%whi%J]
4 changes: 4 additions & 0 deletions msf_resource_scripts/show_all_info.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
show info
show advanced
show actions
show targets
53 changes: 53 additions & 0 deletions opcodes.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/zsh
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
blue=`tput setaf 4`
magenta=`tput setaf 5`
grey=`tput setaf 8`
reset=`tput sgr0`
bold=`tput bold`
underline=`tput smul`

print_good(){
echo "${green}[+]${reset}" $1
}

print_error(){
echo "${red}[x]${reset}" $1
}

print_info(){
echo "[*]" $1
}

print_warning(){
echo "${yellow}[!]${reset}" $1
}
if [[ "$@" =~ .*-h.* ]]; then
echo "Usage:"
echo "\topcodes <file> [<format>]"
echo "Description:"
echo "\tExtract opcodes from an executable file using objdump"
echo "Arguments:"
echo "\tfile - file to extract opcodes from"
echo "\tformat - output format [*hex|bytes]"
return
fi
format="hex"
file=$1
if [ $# -eq 0 ]; then
print_error "Specify file"
return
fi
if [ $# -eq 2 ]; then
format=$2
fi
if [ $? -eq 1 ]; then
return
fi
if [ "$format" = "hex" ]; then
objdump -d $file | grep -Po '\s\K[a-f0-9]{2}(?=\s)' | sed 's/^/\\x/g' | perl -pe 's/\r?\n//' | sed 's/$/\n/'
else
objdump -d $file | grep -Po '\s\K[a-f0-9]{2}(?=\s)' | sed 's/^//g' | perl -pe 's/\r?\n//' | sed 's/$/\n/'
fi
Loading

0 comments on commit 75d37a9

Please sign in to comment.