t3l3machus / Villain

Villain is a high level stage 0/1 C2 framework that can handle multiple reverse TCP & HoaxShell-based shells, enhance their functionality with additional features (commands, utilities) and share them among connected sibling servers (Villain instances running on different machines).
Other
3.77k stars 611 forks source link

Core/villain_core.py: host and uname default values #24

Closed abuyusif01 closed 3 months ago

abuyusif01 commented 1 year ago

Signed-off-by: abuyusif01 abubakaryusuf951@gmail.com

Sometimes the client wont give the username and hostname, especially if the terminal is not a tty. so villian will fail if it tries to get username from url_split. This commit solves that by having a try block. if we succeed in retrieving hostname and username. then fine, else we set the default value to host, user respectively

t3l3machus commented 3 months ago

Hi @abuyusif01, sorry for the huge delay. I didn't have time to monitor PRs for a long time. I already pushed a similar fix for this issue some time ago. I'm gonna close this, but if you want to appear in the contributors as this was a valid issue reported early, you can make a new PR replacing lines 1150-1158 in villain_core.py with this slightly improved version that informs the user of the undefined hostname and user. This concerns the dev branch that is ahead of main:

            try:
                Sessions_Manager.active_sessions[session_id]['Computername'] = url_split[1]
                Sessions_Manager.active_sessions[session_id]['Username'] = url_split[2]
                print_to_prompt(f'\r[{GREEN}Shell{END}] Backdoor session established on {ORANGE}{self.client_address[0]}{END}')

            except IndexError:
                Sessions_Manager.active_sessions[session_id]['Computername'] = 'Undefined'
                Sessions_Manager.active_sessions[session_id]['Username'] = 'Undefined'          
                print_to_prompt(f'\r[{GREEN}Shell{END}] Backdoor session established on {ORANGE}{self.client_address[0]}{END} (hostname and user undefined)')
abuyusif01 commented 3 months ago

Hi @t3l3machus

i've created a PR to the dev with the fix.

Thanks for reviewing the PR