Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50e6e0f
commit 4485ea2
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/usr/bin/python3 | ||
# Author: Daniel Sauder | ||
# License: https://www.gnu.org/licenses/gpl.txt or LICENSE file | ||
# Web: https://github.com/govolution/avet | ||
|
||
import glob, os, readline | ||
import subprocess, stat | ||
|
||
banner = """ | ||
________ ________ ________ | ||
|\ __ \|\ _____\\ ____\ | ||
\ \ \|\ /\ \ \__/\ \ \___| | ||
\ \ __ \ \ __\\ \ \ ___ | ||
\ \ \|\ \ \ \_| \ \ \|\ \ | ||
\ \_______\ \__\ \ \_______\ | ||
\|_______|\|__| \|_______| | ||
Binary Fancy Generator Fabric by Daniel Sauder | ||
""" | ||
|
||
def rlinput(prompt, prefill=''): | ||
readline.set_startup_hook(lambda: readline.insert_text(prefill)) | ||
try: | ||
return input(prompt) | ||
finally: | ||
readline.set_startup_hook() | ||
|
||
|
||
print(banner) | ||
print("bfg_fabric.py is an assistant for building exe files with the purpose of (shell-)code execution, injection and more.\n") | ||
|
||
# read and print build scripts | ||
file_counter=0; | ||
file_list = [] | ||
os.chdir("./build") | ||
for file in glob.glob("build*.sh"): | ||
print(str(file_counter)+": "+file) | ||
file_list.append(file) | ||
file_counter+=1 | ||
|
||
choice=input("Input number of the script you want use and hit enter: ") | ||
fname=file_list[int(choice)] | ||
|
||
print("\nNow you can edit the build script line by line.\n") | ||
commands=[] | ||
commands.append("#/bin/bash") | ||
# read the build scipt | ||
with open(fname) as fi: | ||
for line in fi: | ||
line=line.rstrip() | ||
if line[0:2]!="#!" and line[0]=="#": | ||
print(line.lstrip('#').lstrip()) | ||
elif line[0:2]!="#!": | ||
cmd=rlinput("$ ", line) | ||
commands.append(cmd) | ||
|
||
print("\nThe following commands will be executed:") | ||
|
||
for cmd in commands: | ||
print(cmd) | ||
|
||
input("\nPress enter to continue.") | ||
|
||
os.chdir("..") | ||
with open("build/tmpbuildscript.sh", mode="w") as f: | ||
f.write('\n'.join(commands)) | ||
|
||
|
||
print("\nBuilding the output file...\n\nPlease stand by...") | ||
st = os.stat('./build/tmpbuildscript.sh') | ||
os.chmod('./build/tmpbuildscript.sh', st.st_mode | stat.S_IEXEC) | ||
subprocess.check_output(['/bin/bash','./build/tmpbuildscript.sh'], stderr=subprocess.STDOUT) | ||
os.remove('./build/tmpbuildscript.sh') | ||
|
||
print("\nThe output file should be placed in the current directory.\n\nBye...") |