Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from Veil-Framework/master
Browse files Browse the repository at this point in the history
Added Support for Arch Linux and its Derivatives
  • Loading branch information
nkitan authored Dec 29, 2020
2 parents ab5a199 + e33da37 commit 0928620
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 41 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
[2020-04-22]
Released.: 3.1.14
Modified.: Fix for #351, it was just superficial and never stopped the tool from running, but changes "is not" to !=

[2020-03-25]
Released.: 3.1.13
Modified.: Imports now use new version of imports, and updated setup script (both were pull requests)

[2019-06-17]
Released.: 3.1.12
Fixed....: Pyherion including tabs in imports could cause syntax errors, tabs are now stripped only for imports
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The following OSs are officially supported:
The following OSs are likely able to run Veil:

- Arch Linux
- Manjaro Linux
- BlackArch Linux
- Deepin 15+
- Elementary
Expand Down
2 changes: 2 additions & 0 deletions Veil.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@


if __name__ == "__main__":
import os
os.chdir(os.path.dirname(os.path.realpath(__file__)))

parser = argparse.ArgumentParser(
add_help=False, description="Veil is a framework containing multiple\
Expand Down
23 changes: 18 additions & 5 deletions config/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
os="$( awk -F '=' '/^ID=/ {print $2}' /etc/os-release 2>&- )"

if [ "${os}" == "arch" ] \
|| [ "${os}" == "manjaro" ]\
|| [ "${os}" == "blackarch" ] \
|| [ "${os}" == "debian" ] \
|| [ "${os}" == "deepin" ] \
Expand Down Expand Up @@ -32,16 +33,24 @@ fi

userprimarygroup="$( id -Gn "${trueuser}" | cut -d' ' -f1 )"
arch="$( uname -m )"
if [ "${os}" == "\"void\"" ]; then

if [ "${os}" == "manjaro" ]; then
osversion="$(uname -r)"
elif [ "${os}" == "\"void\"" ]; then
osversion="$(uname -r)"
else
osversion="$( awk -F '=' '/^VERSION_ID=/ {print $2}' /etc/os-release 2>&- | sed 's/"//g' )"
fi
if [ "${os}" == "\"void\"" ]; then

if [ "${os}" == "manjaro" ]; then
osmajversion="$(uname -a | cut -f3 -d\ | cut -f-2 -d.)"
elif [ "${os}" == "\"void\"" ]; then
osmajversion="$(uname -a | cut -f3 -d\ | cut -f-2 -d.)"
else
osmajversion="$( awk -F '["=]' '/^VERSION_ID=/ {print $3}' /etc/os-release 2>&- | cut -d'.' -f1 )"
osmajversion="$( awk -F '["=]' '/^VERSION_ID=/ {print $3}' /etc/os-release 2>&- | cut -d'.' -f1 )"
fi


veildir="/var/lib/veil"
outputdir="${veildir}/output"
dependenciesdir="${veildir}/setup-dependencies"
Expand Down Expand Up @@ -386,7 +395,8 @@ func_package_deps(){
echo -e " ${RED}[ERROR] ${msg}${RESET}\n"
fi

elif [ "${os}" == "arch" ]; then
elif [ "${os}" == "arch" ] \
|| [ "${os}" == "manjaro" ]; then
AUR_packages()
{
if [ $1 == 'yay' ]; then
Expand Down Expand Up @@ -589,6 +599,7 @@ func_package_deps(){
echo -e " ${RED}[ERROR] ${msg}${RESET}\n"
fi
elif [ "${os}" == "arch" ] \
|| [ "${os}" == "blackarch" ] \
|| [ "${os}" == "blackarch" ]; then
echo -e "\n\n [*] ${YELLOW}Installing Wine 32-bit on x86_64 System (via PACMAN)${RESET}\n"
if grep -Fxq "#[multilib]" /etc/pacman.conf; then
Expand Down Expand Up @@ -784,7 +795,7 @@ func_python_deps(){

## Use wine based pip to install dependencies
echo -e "\n\n [*] ${YELLOW}Installing (Wine) Python's PIP pefile${RESET}\n"
sudo -u "${trueuser}" WINEPREFIX="${winedir}" wine "${winedir}/drive_c/Python34/python.exe" "-m" "pip" "install" "--upgrade" "pip"
sudo -u "${trueuser}" WINEPREFIX="${winedir}" wine "${winedir}/drive_c/Python34/python.exe" "-m" "pip" "install" "--upgrade" "pip==19.1.*"
tmp="$?"
if [[ "${tmp}" -ne "0" ]]; then
msg="Failed to run (wine) Python pip... Exit code: ${tmp}"
Expand Down Expand Up @@ -1038,6 +1049,8 @@ else
echo -e " [I] ${YELLOW}Arch Linux ${arch} detected...${RESET}\n"
elif [ "${os}" == "blackarch" ]; then
echo -e " [I] ${YELLOW}BlackArch Linux ${arch} detected...${RESET}\n"
elif [ "${os}" == "manjaro" ]; then
echo -e " [I] ${YELLOW}Manjaro Linux ${arch} detected...${RESET}\n"
elif [ "${os}" == "debian" ]; then
echo -e " [!] ${YELLOW}Debian Linux sid/TESTING ${arch} *possibly* detected..."
echo -e " If you are not currently running Debian Testing, you should exit this installer!${RESET}\n"
Expand Down
2 changes: 1 addition & 1 deletion lib/common/completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def complete_info(self, args):
parts = name.split("/")

# iterate down the split parts so we can handle the nested payload structure
for x in xrange(len(parts)):
for x in range(len(parts)):

# if the first part of the iterated payload matches the language, append it
if parts[x] == lang:
Expand Down
11 changes: 11 additions & 0 deletions lib/common/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import re
import string
import sys
import importlib.util


# Try to find and import the settings.py config file
Expand Down Expand Up @@ -160,3 +161,13 @@ def validate_port(port_number):
return False
except ValueError:
return False


def load_module(module_path):
"""
Takes module path, return module object
"""
spec = importlib.util.spec_from_file_location(module_path, module_path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
2 changes: 1 addition & 1 deletion lib/common/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
sys.exit()

# Current version of Veil
veil_version = "3.1.12"
veil_version = "3.1.14"


def title_screen():
Expand Down
6 changes: 2 additions & 4 deletions lib/common/orchestra.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

import glob
import imp
import os
import readline
import sys
Expand Down Expand Up @@ -72,9 +71,8 @@ def load_tools(self, command_line_object):
# (Evasion, Ordnance, Pillage, etc.)
for name in glob.glob('tools/*/tool.py'):
if name.endswith(".py") and ("__init__" not in name):
loaded_tool = imp.load_source(
name.replace("/", ".").rstrip('.py'), name)
self.imported_tools[name] = loaded_tool.Tools(
module = helpers.load_module(name)
self.imported_tools[name] = module.Tools(
command_line_object)
return

Expand Down
2 changes: 1 addition & 1 deletion tools/evasion/evasion_common/outfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def compiler(payload_object, invoked=False, cli_object=None):
# Used when outputting exe files, go figure
executable_filepath = settings.PAYLOAD_COMPILED_PATH + file_name + ".exe"

if payload_object.language is not "native" and payload_object.extension is not "war":
if payload_object.language != "native" and payload_object.extension != "war":
with open(source_code_filepath, 'w') as source_file:
source_file.write(payload_object.payload_source_code)

Expand Down
4 changes: 2 additions & 2 deletions tools/evasion/evasion_common/shellcode_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def menu(self):
if selection != '':
num_extra_options = selection.split(' ')
for xtra_opt in num_extra_options:
if xtra_opt is not '':
if xtra_opt != '':
if "=" not in xtra_opt:
print(helpers.color(" [!] Parameter not entered in correct syntax.\n", warning=True))
continue
Expand Down Expand Up @@ -547,7 +547,7 @@ def cli_msf_shellcode_gen(command_line_args):
if command_line_args.msfoptions is not None:
num_extra_options = command_line_args.msfoptions.split(' ')
for xtra_opt in num_extra_options:
if xtra_opt is not '':
if xtra_opt != '':
if "=" not in xtra_opt:
print(helpers.color(" [!] Parameter not entered in correct syntax.\n", warning=True))
sys.exit()
Expand Down
34 changes: 16 additions & 18 deletions tools/evasion/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

import glob
import imp
import os
import readline
import subprocess
Expand Down Expand Up @@ -192,7 +191,7 @@ def cli_menu(self, invoked=False):
# -c
if self.command_options.c is not None:
for payload_option in self.command_options.c:
if payload_option is not '':
if payload_option != '':
if "=" not in payload_option:
print(helpers.color(" [!] Payload option not entered in correct syntax.\n", warning=True))
sys.exit()
Expand Down Expand Up @@ -246,9 +245,8 @@ def load_payloads(self, cli_args):
for x in range(1, 5):
for name in glob.glob(join("tools/evasion/payloads/" + "*/" * x,'[!_]*.py')):
if name.endswith(".py") and ("__init__" not in name):
loaded_payloads = imp.load_source(
name.replace("/", ".").rstrip('.py'), name)
self.active_payloads[name.replace('tools/evasion/payloads/', '')] = loaded_payloads.PayloadModule(cli_args)
module = helpers.load_module(name)
self.active_payloads[name.replace('tools/evasion/payloads/', '')] = module.PayloadModule(cli_args)
return

def print_options_screen(self, pload_object):
Expand Down Expand Up @@ -285,18 +283,18 @@ def payload_info(self, payload_obj, showTitle=True, showInfo=True):
def return_payload_object(self, user_selection):
# This function handles returning the selected payload module object
# to the calling function
counter_value = 1
for payload_path, payload_module in sorted(self.active_payloads.items()):
if user_selection.isdigit() and (0 < int(user_selection) <= len(self.active_payloads)):
if int(user_selection) == counter_value:
return payload_module
else:
if user_selection.strip().lower() == payload_path:
return payload_module

# Iterate counter for number based selection
counter_value += 1
return False
payloads = sorted(self.active_payloads.items())
payload_by_path = [payload for payload in payloads if payload[0] == user_selection.strip().lower()]

if user_selection.isdigit() and (0 < int(user_selection) <= len(self.active_payloads)):
# minus 1 because menu starts counting at 1 not 0
user_selection = int(user_selection) - 1
return payloads[user_selection][1]
elif payload_by_path:
return payload_by_path[0][1]
else:
return False

def tool_main_menu(self):
# This is the main function where everything is called from
Expand Down Expand Up @@ -417,15 +415,15 @@ def use_payload(self, selected_payload):
key = key.upper()
if key in selected_payload.required_options:
# Validate LHOST value
if key is "LHOST":
if key == "LHOST":
if helpers.validate_ip(value):
selected_payload.required_options[key][0] = value
else:
print()
print(helpers.color(" [!] ERROR: You did not provide a valid IP!", warning=True))
print()
# Validate LPORT
elif key is "LPORT":
elif key == "LPORT":
if helpers.validate_port(value):
selected_payload.required_options[key][0] = value
else:
Expand Down
15 changes: 6 additions & 9 deletions tools/ordnance/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

import glob
import imp
import readline
import sys
from lib.common import helpers
Expand Down Expand Up @@ -99,7 +98,7 @@ def cli_menu(self, invoked=False):
payload.cli_gen_shellcode()
self.final_shellcode = payload.customized_shellcode
# Check if an encoder is being called by the user
if self.command_options.encoder is not None:
if self.command_options.encoder != None:
encoder_found_here = False
if "BadChars" in payload.required_options:
payload.required_options["BadChars"][0] = self.command_options.bad_chars
Expand All @@ -121,17 +120,15 @@ def cli_menu(self, invoked=False):
def load_encoders(self, cli_args):
for name in sorted( glob.glob('tools/ordnance/encoders/*.py') ):
if name.endswith(".py") and ("__init__" not in name):
loaded_encoder = imp.load_source(
name.replace("/", ".").rstrip('.py'), name)
self.active_encoders[name] = loaded_encoder.EncoderModule(cli_args)
module = helpers.load_module(name)
self.active_encoders[name] = module.EncoderModule(cli_args)
return

def load_payloads(self, cli_args):
for name in sorted( glob.glob('tools/ordnance/payloads/x86/*.py') ):
if name.endswith(".py") and ("__init__" not in name):
loaded_payloads = imp.load_source(
name.replace("/", ".").rstrip('.py'), name)
self.active_shellcode[name] = loaded_payloads.ShellcodeModule(cli_args)
module = helpers.load_module(name)
self.active_shellcode[name] = module.ShellcodeModule(cli_args)
return

def print_encoders(self):
Expand Down Expand Up @@ -379,7 +376,7 @@ def use_payload(self, payload):
self.payload_options['RHOST'] = rhost_out

# Check if encoder is needed
if payload.required_options["Encoder"][0] is not "None":
if payload.required_options["Encoder"][0] != "None":
self.use_encoder(payload)
self.final_shellcode = payload.customized_shellcode

Expand Down

0 comments on commit 0928620

Please sign in to comment.