Coder Social home page Coder Social logo

Problem establishing connection about needle HOT 15 CLOSED

mehadhe avatar mehadhe commented on August 16, 2024
Problem establishing connection

from needle.

Comments (15)

marco-lancini avatar marco-lancini commented on August 16, 2024

Can you SSH into the device manually? (without using needle)

from needle.

mehadhe avatar mehadhe commented on August 16, 2024

from needle.

Yogehi avatar Yogehi commented on August 16, 2024

@mehadhe weird question, but is your device set so the screen doesn't turn off automatically? the screen needs to be on while needle is running

from needle.

mehadhe avatar mehadhe commented on August 16, 2024

from needle.

Yogehi avatar Yogehi commented on August 16, 2024

can you post the full terminal log? i know you set "debug true" but i want to see the exact commands needle is running, which means i need to see the full terminal log

from needle.

marco-lancini avatar marco-lancini commented on August 16, 2024

@bshieh: from your error (#260) I can see:

connection refused

Are you sure you disconnected every other connection before trying to connect with needle?

from needle.

bshieh avatar bshieh commented on August 16, 2024

@marco-lancini Yes, I tried rebooting my macbook to be sure. Something to note is that when I used "shell" in Needle, it worked only the very first time I ran it. All subsequent attempts failed with the same error message as when running a module.

from needle.

mehadhe avatar mehadhe commented on August 16, 2024

@Yogehi , PFA the screenshots for your reference. Hope this helps...

image

image

image

from needle.

Yogehi avatar Yogehi commented on August 16, 2024

can you run ps ax | grep needle in another terminal while running needle?

the application definitely thinks there is already a connection to the device before attempting to run the module.

another option: i see that you're running osx. could you try sudo -H python ./needle.py and see if that works, but also do NOT run iproxy 2222 22 or whatever you are running that sets up the port forwarding.

if you run needle with sudo, it should automatically setup a port forward for you.

my logs below showing this:

Yays-Mac:needle yayusernameyay$ system_profiler SPSoftwareDataType | grep System
    System Software Overview:
      System Version: macOS 10.13.6 (17G65)
      System Integrity Protection: Enabled
Yays-Mac:needle yayusernameyay$ sudo -H python ./needle.py

             __   _ _______ _______ ______         _______
             | \  | |______ |______ |     \ |      |______
             |  \_| |______ |______ |_____/ |_____ |______
        
                   Needle v1.3.2 [mwr.to/needle]                  
  [MWR InfoSecurity (@MWRLabs) - Marco Lancini (@LanciniMarco)]   

[needle] > set debug true
DEBUG => true
[needle] > use binary/info/metadata
[needle][metadata] > run
[D] Setup local output folder: /var/root/.needle/output
[?] Attention! The folder chosen to store local output is not empty: /var/root/.needle/output
[?] Do you want to back it up first?
[?] Y: the content will be archived in a different location, then the folder will be emptied
[?] N: no action will be taken (destination files might be overwritten in case of filename clash)
[y/n]: n
[D] Setting up issues database...
[D] [DB] QUERY: CREATE TABLE IF NOT EXISTS issues (app TEXT, module TEXT, name TEXT, content TEXT, confidence TEXT, outfile TEXT)
[*] Checking connection with device...
[V] Connection not present, creating a new instance
[D] Setting up USB port forwarding on port 2222
[D] [LOCAL CMD] Local Subprocess Command: /Users/yayusernameyay/Desktop/programs/needle/needle/libs/usbmuxd/tcprelay.py -t 22:2222
[D] [AGENT] Setting up port forwarding on port 4444
[V] [AGENT] Connecting to agent (127.0.0.1:4444)...
[+] [AGENT] Successfully connected to agent (127.0.0.1:4444)...
[D] [AGENT] Executing command: os_version
[V] [SSH] Connecting (127.0.0.1:2222)...
[+] [SSH] Connected (127.0.0.1:2222)
[D] Creating temp folder: /var/root/needle/
[D] [REMOTE CMD] Remote Command: if [ -d /var/root/needle/ ]; then echo "yes"; else echo "no" ; fi
[D] [REMOTE CMD] Remote Command: mkdir /var/root/needle/
[D] [AGENT] Executing command: os_version
[*] Target app not selected. Launching wizard...
[D] [AGENT] Executing command: list_apps
[+] Apps found:
[>][QUESTION] Please select a number: 

The device I used in the above log was running OS 11.3.1 with electra jailbreak

from needle.

mehadhe avatar mehadhe commented on August 16, 2024

from needle.

marco-lancini avatar marco-lancini commented on August 16, 2024

@mehadhe: were you trying to connect over WiFi before?

from needle.

mehadhe avatar mehadhe commented on August 16, 2024

from needle.

marco-lancini avatar marco-lancini commented on August 16, 2024

In the screenshot above you obscured the IP setting. Are you able to share the full config (unobfuscated)?

from needle.

bshieh avatar bshieh commented on August 16, 2024

@Yogehi I tried running ps ax | grep needle in another terminal while running needle and got this output:

User-MacBook-Pro:~ username$ ps ax | grep needle
  715 s001  S+     0:00.04 sudo -H python needle.py
  716 s001  S+     0:00.54 /usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python needle.py
  719 s002  S+     0:00.00 grep needle

I have actually been running needle with sudo -H python needle.py. I tried unloading the com.usbmux.iproxy.plist file with launchctl unload ~/Library/LaunchAgents/com.usbmux.iproxy.plist which enables me to SSH over USB, and got the same error as before

2018-07-27 11:19:35,181| ERROR   | Could not open connection to gateway
[!] Problem establishing connection: BaseSSHTunnelForwarderError -  
[!] BaseSSHTunnelForwarderError: Could not establish session to SSH gateway

from needle.

mehadhe avatar mehadhe commented on August 16, 2024

@Yogehi, The connection establishment problem resolved by connecting the device via USB cable and configured the file as below.

Automated Configuration file

set AGENT_PORT 4444
set APP
set DEBUG True
set HIDE_SYSTEM_APPS False
set IP 127.0.0.1
set PORT 2222
set OUTPUT_FOLDER /Users/mehadhe_sameer/needle/needle/output
set PASSWORD my_password
set SKIP_OUTPUT_FOLDER_CHECK True
set USERNAME root
set VERBOSE True

from needle.

Related Issues (20)

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.