Skip to content

Commit

Permalink
Merge branch 'dev'. Version 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
D35YNC committed Apr 15, 2023
2 parents 8583d8f + dceb552 commit 91d30bb
Show file tree
Hide file tree
Showing 25 changed files with 371 additions and 289 deletions.
3 changes: 3 additions & 0 deletions .idea/project94.iml

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

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

57 changes: 47 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,69 @@
# project94 ver.1.0

:trollface: Project94 is a fun software for trolling people.

<div id="badges">
<img src="https://img.shields.io/pypi/v/project94" alt="Package version"/>
<img src="https://img.shields.io/pypi/pyversions/project94" alt="Python version"/>
<img src="https://img.shields.io/github/license/d35ync/project94" alt="License"/>
</div>

### Features
- [X] Multiplying sessions using `select`
- [X] SSL support + client certificate verify
- [ ] TODO Support custom modules (idk why)
- [ ] TODO Support both reverse and bind shells
- [X] SSL support + client certificate verify
- [X] Support both reverse and bind shells
- [X] Cli interface commands autocompletion

### Requirements
- python3.10
- requests (not necessary)

### TROLL TUTORIAL "HOW TO USE"
**STEP 1** Installation
Use one of these methods:
- ~~`sudo pip3 install project94`~~ (TODO)
- `sudo pip3 install project94`
- ```bash
git clone https://github.com/d35ync/project94.git
cd project94
### Stable
git checkout v1.1
### Unstable
git checkout dev
### Or keep on master for 'pre-release'

sudo pip3 install .
```
- `git clone https://github.com/d35ync/project94.git` (yeahs is would works without installing requirements)

**STEP 2**
BEGIN TROLLING :trollface:

**STEP 2** Run
- pip installation: `project94 --help`
- git installation: `python3 -m project94 -V` or `python3 project94.py -V`

**STEP 3**
EZ


### CLI interface info
Default command set:
```
/show displays information of specified type
/interact start interactive shell
/exit shutdown project94
/help display help message
/bindshell connects to bind shell
/encoding changes active session encoding
/kill kill active or specified session
/goto switch to another session
/cmd executes the command in the current or each session
```

U can get extended help for every command:
```
[NO_SESSION]>> /help /show
[*] Help: /show
Description: displays information of specified type
sessions - shows list of sessions and information about them
info - shows information about active session
Usage: /show {sessions, info}
```

### Demo

https://user-images.githubusercontent.com/52525711/232234241-8eec8eb5-3c6b-4032-9991-d606d3af05b3.mp4
1 change: 0 additions & 1 deletion project94.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@

if __name__ == '__main__':
project94.entry()

3 changes: 1 addition & 2 deletions project94/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# from project94.project94 import entry, __version__
from .__main__ import entry, __version__, Project94
from .project94 import *
15 changes: 0 additions & 15 deletions project94/cli_commands/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +0,0 @@
from .base_command import BaseCommand
from .command import Command
from .encoding import Encoding
from .goto import Goto
from .help import Help
from .info import Info
from .interact import Interact
from .kill import Kill
from .multiply_command import MultiCommand
from .sessions import Sessions
from .exit import Exit

__all__ = ["BaseCommand", "Command", "Encoding", "Goto",
"Help", "Exit", "Info", "Interact",
"Kill", "MultiCommand", "Sessions"]
33 changes: 25 additions & 8 deletions project94/cli_commands/base_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,42 @@ def __init__(self, app):
self._app = app

@property
@abc.abstractmethod
def aliases(self) -> list[str]:
raise NotImplementedError()
def name(self) -> str:
"""
:return: Command base name
"""
return f"/{self.__class__.__name__.lower()}"

@property
@abc.abstractmethod
def description(self) -> str:
"""
:return: One line command description
"""
raise NotImplementedError()

@property
def long_description(self) -> str:
"""
:return: Multiline command description
"""
return self.description

@property
@abc.abstractmethod
def usage(self) -> str:
"""
:return: Usage string
"""
raise NotImplementedError()

@property
def subcommands(self) -> list[str]:
"""
:return: List of subcommands
"""
return []

@abc.abstractmethod
def __call__(self, *args, **kwargs):
raise NotImplementedError()

def __str__(self) -> str:
return f"/{self.__class__.__name__.lower()}"


28 changes: 28 additions & 0 deletions project94/cli_commands/bind_shell.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import socket

from .base_command import BaseCommand


class BindShell(BaseCommand):
@property
def description(self) -> str:
return "connects to bind shell"

@property
def usage(self) -> str:
return f"Usage: {self.name} IP PORT"

def __call__(self, *args, **kwargs):
ip = args[1]
try:
port = int(args[2])
except ValueError:
kwargs.get("print_error_callback", lambda x: print(f"[!!!] {x}"))(f"Cant convert {args[1]} to int")
return
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
sock.connect((ip, port))
except socket.error:
kwargs.get("print_error_callback", lambda x: print(f"[!!!] {x}"))(f"Cant connect to {ip}:{port}")
else:
self._app.handle_connection(sock, sock.getpeername())
38 changes: 38 additions & 0 deletions project94/cli_commands/cmd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from .base_command import BaseCommand


class Cmd(BaseCommand):
@property
def description(self) -> str:
return "executes the command in the current or each session"

@property
def usage(self) -> str:
return f"Usage: {self.name} {{current, each}} CMDLINE"

@property
def subcommands(self) -> list[str]:
return ["current", "each"]

def __call__(self, *args, **kwargs):
match args:
case ("/cmd", "current", *cmdline):
if 0 == len(cmdline):
kwargs.get("print_error_callback", lambda x: print(f"[!!!] {x}"))(self.usage)
return
if self._app.active_session:
if cmdline:
self._app.active_session.send_command(" ".join(cmdline))
else:
kwargs.get("print_error_callback", lambda x: print(f"[!!!] {x}"))(self.usage)
else:
kwargs.get("print_warning_callback", lambda x: print(f"[!] {x}"))("Current session is FUCKING DEAD")

case ("/cmd", "each", *cmdline):
if 0 == len(cmdline):
kwargs.get("print_error_callback", lambda x: print(f"[!!!] {x}"))(self.usage)
return
for id_ in self._app.sessions:
self._app.sessions[id_].send_command(" ".join(cmdline))
case _:
kwargs.get("print_error_callback", lambda x: print(f"[!!!] {x}"))(self.usage)
27 changes: 0 additions & 27 deletions project94/cli_commands/command.py

This file was deleted.

18 changes: 5 additions & 13 deletions project94/cli_commands/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,20 @@


class Encoding(BaseCommand):
__args_count = 1

@property
def aliases(self) -> list[str]:
return ["e", "encoding", "chenc"]

@property
def description(self) -> str:
return "changes current session encoding"
return "changes active session encoding"

@property
def usage(self) -> str:
return f"Usage: {self} NEW_ENCODING"
return f"Usage: {self.name} NEW_ENCODING"

def __call__(self, *args, **kwargs):
if len(args) != self.__args_count:
if len(args) != 2:
kwargs.get("print_error_callback", lambda x: print(f"[!!!] {x}"))(self.usage)
return
if self._app.active_session:
if args[0]:
self._app.active_session.encoding = args[0] or "utf-8"
else:
kwargs.get("print_error_callback", lambda x: print(f"[!!!] {x}"))(self.usage)
self._app.active_session.encoding = args[1]
kwargs.get("print_info_callback", lambda x: print(f"[*] {x}"))(f"Installed encoding: {self._app.active_session.encoding}")
else:
kwargs.get("print_warning_callback", lambda x: print(f"[!] {x}"))("Current session is FUCKING DEAD")
12 changes: 7 additions & 5 deletions project94/cli_commands/exit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@


class Exit(BaseCommand):
@property
def aliases(self) -> list[str]:
return ["e", "exit", "q", "quit"]

@property
def description(self) -> str:
return "shutdown project94"

@property
def long_description(self):
return "its really just shutdown\n" \
"Maybe I shouldn't put it in a single module. Because u can delete it xdd.\n" \
"Have fun =)"

@property
def usage(self) -> str:
return f"Usage: {self}"
return f"Usage: {self.name}"

def __call__(self, *args, **kwargs):
self._app.shutdown()
20 changes: 11 additions & 9 deletions project94/cli_commands/goto.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,27 @@


class Goto(BaseCommand):
__args_count = 1

@property
def aliases(self) -> list[str]:
return ["g", "goto"]

@property
def description(self) -> str:
return "switch to another session"

@property
def long_description(self):
return f"{self.description}\n" \
"Session can be identified by ID (hash) or index in sessions list\n" \
"U can view ID and index using \"/show sessions\" command\n" \
"ID arg can be specified partially. Ex. session ID - sus0GOvm0Za1100ppa\n" \
"U can goto this session with \"/goto sus0\""

@property
def usage(self) -> str:
return f"Usage: {self} SESSION_ID | SESSION_INDEX"
return f"Usage: {self.name} SESSION_ID | SESSION_INDEX"

def __call__(self, *args, **kwargs):
if len(args) != self.__args_count:
if len(args) != 2:
kwargs.get("print_error_callback", lambda x: print(f"[!!!] {x}"))(self.usage)
return
if new_session := self._app.find_session(id_=args[0], idx=args[0]):
if new_session := self._app.find_session(id_=args[1], idx=args[1]):
self._app.active_session = new_session
else:
kwargs.get("print_warning_callback", lambda x: print(f"[!] {x}"))("This session does not exist")
Loading

0 comments on commit 91d30bb

Please sign in to comment.