Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
140 changes: 140 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

cloakify-env/*
10 changes: 0 additions & 10 deletions ciphers/dessertsSwedishChef
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ creme-a
soondee-a
streoosel
creem
boottercreem
ceremel
cherry
sooger
shurtceke-a
boottermeelk
hoockleberry
hezelnoot
geenger
Expand All @@ -39,7 +37,6 @@ tuffffee-a
muoosse-a
cunnulee
sherbet
muoosse-a
jelly
cheeseceke-a
chuculete-a
Expand All @@ -66,7 +63,6 @@ coord
lulleepup
bunbun
dunoot
coord
ceke-a
breettle-a
croonch
Expand All @@ -79,15 +75,13 @@ pooffffs
soocker
blooeberry
toornufer
frusteeng
nootmeg
broolee-a
lemun
cunffecshun
terreene-a
respberry
elmund
pooddeeng
turte-a
velnoot
mereeunberry
Expand All @@ -98,17 +92,13 @@ trooffffle-a
cumpute-a
leecurice-a
cucunoot
pooddeeng
peeneepple-a
jem
geengerbreed
iggs
boottercreem
flun
zest
peestechiu
strevberreees
sooger
pestry
écleur
funeella
1 change: 0 additions & 1 deletion ciphers/evadeAV
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ A
5
G
M
0
h
s
o
Expand Down
82 changes: 53 additions & 29 deletions cloakify.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,46 +40,70 @@
# $ ./cloakify.py payload.txt ciphers/desserts > exfiltrate.txt
#

import os, sys, getopt, base64
import base64
import os
import random
import sys

array64 = list("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/+=")

def Cloakify( arg1, arg2, arg3 ):
def Cloakify(payloadPath:str, cipherPath:str, outputPath:str="", password:str=None):
"""Payload file's binary contents will be read and converted into base64.
Cipher file will be read into a list that will be used for the payload's obfuscation.
If an output path is defined the obfuscated content will be written to that otherwise,
it will print it out to the console.

payloadFile = open( arg1, 'rb' )
payloadRaw = payloadFile.read()
payloadB64 = base64.encodestring( payloadRaw )
Args:
payloadPath (str): Path to the file that will be encoded
cipherPath (str): Path to the file used as the base64 cipher
outputPath (str): Path to write out the obfuscated payload
"""

try:
with open( arg2 ) as file:
cipherArray = file.readlines()
except:
print ""
print "!!! Oh noes! Problem reading cipher '", arg2, "'"
print "!!! Verify the location of the cipher file"
print ""
with open(payloadPath, 'rb') as payloadFile:
payloadRaw = payloadFile.read()
payloadB64 = base64.encodebytes(payloadRaw)
payloadB64 = payloadB64.decode("ascii").replace("\n", "")
except Exception as e:
print("Error reading payload file {}: {}".format(payloadPath, e))

if ( arg3 != "" ):
payloadOrdering = None
if password:
random.seed(password)
# Get a list of each line number in the cloaked file
payloadOrdering = [i for i in range(len(payloadB64))]
# Shuffle the order of the lines
random.shuffle(payloadOrdering)

try:
with open(cipherPath, encoding="utf-8") as file:
cipherArray = file.readlines()
except Exception as e:
print("Error reading cipher file {}: {}".format(cipherPath, e))

if outputPath:
try:
with open( arg3, "w+" ) as outFile:
for char in payloadB64:
if char != '\n':
outFile.write( cipherArray[ array64.index(char) ] )
except:
print ""
print "!!! Oh noes! Problem opening or writing to file '", arg3, "'"
print ""
with open(outputPath, "w+", encoding="utf-8") as outFile:
if payloadOrdering:
# Iterate through the randomized line order and write each line to the file
for randomLoc in payloadOrdering:
outFile.write(cipherArray[array64.index(payloadB64[randomLoc])])
else:
for char in payloadB64:
outFile.write(cipherArray[array64.index(char)])
except Exception as e:
print("Error writing to output file {}: {}".format(outputPath, e))

else:
for char in payloadB64:
if char != '\n':
print cipherArray[ array64.index(char) ],
print(cipherArray[array64.index(char)].strip())


if __name__ == "__main__":
if ( len(sys.argv) != 3 ):
print "usage: cloakify.py <payloadFilename> <cipherFilename>"
exit

if len(sys.argv) == 3:
Cloakify( sys.argv[1], sys.argv[2])
elif len(sys.argv) == 4:
Cloakify(sys.argv[1], sys.argv[2], sys.argv[3])
else:
Cloakify( sys.argv[1], sys.argv[2], "" )

print("usage: cloakify.py <payloadFilename> <cipherFilename> <outputFileName-optional>")
exit(-1)
Loading