Skip to content

Commit

Permalink
Merge pull request #12 from dmdhrumilmistry/3.12
Browse files Browse the repository at this point in the history
port to 3.12
  • Loading branch information
dmdhrumilmistry authored Jun 23, 2024
2 parents c822bdd + 20a35e2 commit 16ceb1b
Show file tree
Hide file tree
Showing 8 changed files with 255 additions and 112 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package to PyPi

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:
runs-on: ubuntu-latest
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: |
python -m build
- name: Publish package
uses: pypa/[email protected]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 dmdhrumilmistry
Copyright (c) 2024 dmdhrumilmistry

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

echo -e "\033[33m[*] Starting installation...\033[0m"
apt update -y && apt upgrade -y
apt install python git nmap openssh termux-auth termux-api tor proxychains-ng -y
apt update -y
apt install python git openssh termux-auth termux-api tor proxychains-ng -y
pip install git+https://github.com/dmdhrumilmistry/Termux-SSH.git
echo -e "\033[33m[*] Completed... Start Termux-SSH using python -m termux_ssh and use install command to complete setup.\033[0m";
84 changes: 84 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[tool.poetry]
name = "termux-ssh"
version = "1.2.0"
description = "Termux SSH helps you to setup SSH server on termux application on android, which helps you to execute tasks remotely through terminal/cmd/powershell/termux"
authors = ["Dhrumil Mistry <[email protected]>"]
license = "MIT"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"
colorama = "^0.4.6"
prettytable = "^3.10.0"
netifaces = "^0.11.0"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
21 changes: 0 additions & 21 deletions setup.py

This file was deleted.

146 changes: 85 additions & 61 deletions termux_ssh/__main__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
#!usr/bin/env python3
from termux_ssh.termux import *
from os import name
from sys import exit

from .termux import (
BRIGHT_RED,
BRIGHT_YELLOW,
RESET_COLORS,
BRIGHT_WHITE,
BRIGHT_GREEN,
clear_console,
cowsay_banner,
exception_message,
exit_program,
get_ssh_port,
get_user,
generate_passwd,
get_tor_hostname,
get_wlan_ip,
restart_ssh,
show_connect_command,
start_ssh,
start_tor_ssh,
stop_tor,
install_cmd,
)


if name == 'nt':
print(BRIGHT_RED + '[-] Termux-SSH is created for Termux Application on Android.')
print(BRIGHT_YELLOW + '[!] Exiting Termux-SSH')
Expand All @@ -16,74 +38,76 @@

while True:
try:

cmd = input(BRIGHT_YELLOW + "Termux-SSH >> " + RESET_COLORS).lower().strip()

if cmd == 'exit':
exit_program(kill_ssh_server=True, kill_tor_server=True)
match cmd:
case 'exit':
exit_program(kill_ssh_server=True, kill_tor_server=True)

elif cmd == 'close':
exit_program()
case 'close':
exit_program()

elif cmd == 'help':
help()
case 'help':
help()

elif cmd == 'clear':
clear_console()

elif cmd == 'install':
install_cmd()

elif cmd == 'start':
if start_ssh():
print(BRIGHT_WHITE + '[*] SSH started successfully')
else:
print(BRIGHT_RED + '[-] Cannot Start SSH Server')

elif cmd == 'port':
ssh_port = get_ssh_port()
if ssh_port:
print(BRIGHT_WHITE + f'[*] PORT : {ssh_port}')
else:
print(BRIGHT_YELLOW + '[!] Start SSH server before finding the port')

elif cmd == 'user':
username = get_user()
print(BRIGHT_WHITE + f'[*] USER : {username}')

elif cmd == 'genpass':
generate_passwd()

elif cmd == 'wlanip':
wlan_ip = get_wlan_ip()
print(BRIGHT_WHITE + f'[*] WLAN IP : {wlan_ip}')

elif cmd == 'conncmd':
show_connect_command()
case 'clear':
clear_console()

elif cmd == 'torssh':
start_tor_ssh()
print(BRIGHT_GREEN + "[*] SSH can be connected over TOR.")

elif cmd == 'torhost':
hostname = get_tor_hostname()
if hostname != "":
print(BRIGHT_GREEN + f"[*] Hostname : {hostname}")
else:
print(BRIGHT_RED + f"[X] Cannot find hostname, try using install command.")

elif cmd == 'torstop':
stop_tor()
print(BRIGHT_GREEN + "[*] SSH over TOR stopped successfully.")

elif cmd == 'restart':
restart_ssh()

else:
print(BRIGHT_RED + '[!] INVALID COMMAND')
case 'install':
install_cmd()

case 'start':
if start_ssh():
print(BRIGHT_WHITE + '[*] SSH started successfully')
else:
print(BRIGHT_RED + '[-] Cannot Start SSH Server')

case 'port':
ssh_port = get_ssh_port()
if ssh_port:
print(BRIGHT_WHITE + f'[*] PORT : {ssh_port}')
else:
print(BRIGHT_YELLOW + '[!] Start SSH server before finding the port')

case 'user':
username = get_user()
print(BRIGHT_WHITE + f'[*] USER : {username}')

case 'genpass':
generate_passwd()

case 'wlanip':
wlan_ip = get_wlan_ip()
print(BRIGHT_WHITE + f'[*] WLAN IP : {wlan_ip}')

case 'conncmd':
show_connect_command()

case 'torssh':
start_tor_ssh()
print(BRIGHT_GREEN + "[*] SSH can be connected over TOR.")

case 'torhost':
hostname = get_tor_hostname()
if hostname != "":
print(BRIGHT_GREEN + f"[*] Hostname : {hostname}")
else:
print(BRIGHT_RED + "[X] Cannot find hostname, try using install command.")

case 'torstop':
stop_tor()
print(BRIGHT_GREEN + "[*] SSH over TOR stopped successfully.")

case 'restart':
restart_ssh()

case _:
print(BRIGHT_RED + '[!] INVALID COMMAND')

except (EOFError, KeyboardInterrupt):
print(BRIGHT_RED + "\n[-] User interruption detected! Services will be running in background")
exit_program()

except Exception as e:
Exception_Message(e)
exception_message(e)
Loading

0 comments on commit 16ceb1b

Please sign in to comment.