New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python meterpreter whitespace normalization #9392

Merged
merged 1 commit into from Jan 13, 2018

Conversation

Projects
None yet
3 participants
@busterb
Contributor

busterb commented Jan 9, 2018

This modifies python meterpreter to only uses spaces for indentation, which is pretty standard for python code. rapid7/metasploit-payloads#265

Verification

  • Verify that python meterpreter works exactly as before, with no changes in behavior (system tests pass below)
@bwatters-r7

This comment has been minimized.

Show comment
Hide comment
@bwatters-r7

bwatters-r7 Jan 9, 2018

Contributor

x86 Python 2.7
image
Not sure about that one error.... It looks like meterpreter barfed a bit getting things set up?

[*] Meterpreter session 1 opened (192.168.135.112:30013 -> 192.168.134.152:49997) at 2018-01-09 13:25:16 -0800
[*] Session 1 created in the background.
> sessions -C sysinfo
[*] Running 'sysinfo' on meterpreter session 1 (192.168.134.152)
[-] Error running command sysinfo: Rex::TimeoutError Operation timed out.
> sessions -C ifconfig
[*] Running 'ifconfig' on meterpreter session 1 (192.168.134.152)
[*] 192.168.134.152 - Meterpreter session 1 closed.  Reason: Died
Contributor

bwatters-r7 commented Jan 9, 2018

x86 Python 2.7
image
Not sure about that one error.... It looks like meterpreter barfed a bit getting things set up?

[*] Meterpreter session 1 opened (192.168.135.112:30013 -> 192.168.134.152:49997) at 2018-01-09 13:25:16 -0800
[*] Session 1 created in the background.
> sessions -C sysinfo
[*] Running 'sysinfo' on meterpreter session 1 (192.168.134.152)
[-] Error running command sysinfo: Rex::TimeoutError Operation timed out.
> sessions -C ifconfig
[*] Running 'ifconfig' on meterpreter session 1 (192.168.134.152)
[*] 192.168.134.152 - Meterpreter session 1 closed.  Reason: Died
@busterb

This comment has been minimized.

Show comment
Hide comment
@busterb

busterb Jan 9, 2018

Contributor

That's random. Also, I noticed Travis is failing because Ubuntu's package servers are experiencing an error at the moment.

Contributor

busterb commented Jan 9, 2018

That's random. Also, I noticed Travis is failing because Ubuntu's package servers are experiencing an error at the moment.

@bwatters-r7

This comment has been minimized.

Show comment
Hide comment
@bwatters-r7

bwatters-r7 Jan 9, 2018

Contributor

x64 Python 2.7
image

Uhhhh..... this one is more interesting. Two sessions get established? One is broken, they fight?

[*] Started reverse TCP handler on 192.168.135.138:30006 
[*] Sending stage (50248 bytes) to 192.168.134.161
[*] Meterpreter session 1 opened (192.168.135.138:30006 -> 192.168.134.161:50555) at 2018-01-09 13:40:35 -0800
[*] Sending stage (50248 bytes) to 192.168.134.164
[*] Meterpreter session 2 opened (192.168.135.138:30006 -> 192.168.134.164:49752) at 2018-01-09 13:40:39 -0800
[*] Session 2 created in the background.
[*] resource (/home/msfuser/rapid7/test_artifacts/test_rc/python-meterpreter-reverse_tcp-192x168x134x164-30006.rc)> Ruby Code (83 bytes)
resource (/home/msfuser/rapid7/test_artifacts/test_rc/python-meterpreter-reverse_tcp-192x168x134x164-30006.rc)> sessions -C sysinfo
[*] Running 'sysinfo' on meterpreter session 1 (192.168.134.161)
[-] Unknown command: sysinfo.
[*] Running 'sysinfo' on meterpreter session 2 (192.168.134.164)
Computer        : Win10x64-1607
OS              : Windows 10 (Build 14393)
Architecture    : x64
System Language : en_US
Meterpreter     : python/windows

Relevant pcap:
image

Contributor

bwatters-r7 commented Jan 9, 2018

x64 Python 2.7
image

Uhhhh..... this one is more interesting. Two sessions get established? One is broken, they fight?

[*] Started reverse TCP handler on 192.168.135.138:30006 
[*] Sending stage (50248 bytes) to 192.168.134.161
[*] Meterpreter session 1 opened (192.168.135.138:30006 -> 192.168.134.161:50555) at 2018-01-09 13:40:35 -0800
[*] Sending stage (50248 bytes) to 192.168.134.164
[*] Meterpreter session 2 opened (192.168.135.138:30006 -> 192.168.134.164:49752) at 2018-01-09 13:40:39 -0800
[*] Session 2 created in the background.
[*] resource (/home/msfuser/rapid7/test_artifacts/test_rc/python-meterpreter-reverse_tcp-192x168x134x164-30006.rc)> Ruby Code (83 bytes)
resource (/home/msfuser/rapid7/test_artifacts/test_rc/python-meterpreter-reverse_tcp-192x168x134x164-30006.rc)> sessions -C sysinfo
[*] Running 'sysinfo' on meterpreter session 1 (192.168.134.161)
[-] Unknown command: sysinfo.
[*] Running 'sysinfo' on meterpreter session 2 (192.168.134.164)
Computer        : Win10x64-1607
OS              : Windows 10 (Build 14393)
Architecture    : x64
System Language : en_US
Meterpreter     : python/windows

Relevant pcap:
image

@bwatters-r7

This comment has been minimized.

Show comment
Hide comment
@bwatters-r7

bwatters-r7 Jan 9, 2018

Contributor

I'm seeing some permission errors when running commands on python 3 running the meterpreter test post module?
[-] Exception: Rex::Post::Meterpreter::RequestError : stdapi_fs_ls: Operation failed: Python exception: PermissionError

Contributor

bwatters-r7 commented Jan 9, 2018

I'm seeing some permission errors when running commands on python 3 running the meterpreter test post module?
[-] Exception: Rex::Post::Meterpreter::RequestError : stdapi_fs_ls: Operation failed: Python exception: PermissionError

@bwatters-r7

This comment has been minimized.

Show comment
Hide comment
@bwatters-r7

bwatters-r7 Jan 10, 2018

Contributor

Just FYI, this is what I'm seeing with x64 python 3. Will dig more tomorrow.
image

Contributor

bwatters-r7 commented Jan 10, 2018

Just FYI, this is what I'm seeing with x64 python 3. Will dig more tomorrow.
image

@busterb

This comment has been minimized.

Show comment
Hide comment
@busterb

busterb Jan 10, 2018

Contributor

Thanks @bwatters-r7. I get the sense that these are pre-existing conditions, but good finds.

Contributor

busterb commented Jan 10, 2018

Thanks @bwatters-r7. I get the sense that these are pre-existing conditions, but good finds.

@jmartin-r7 jmartin-r7 added the delayed label Jan 10, 2018

@jmartin-r7 jmartin-r7 self-assigned this Jan 12, 2018

@jmartin-r7

This comment has been minimized.

Show comment
Hide comment
@jmartin-r7

jmartin-r7 Jan 13, 2018

Contributor

Failures look to be sessions that are not fully enumerated when automation progresses. Landing this since failures are unrelated to whitespace changes.

Contributor

jmartin-r7 commented Jan 13, 2018

Failures look to be sessions that are not fully enumerated when automation progresses. Landing this since failures are unrelated to whitespace changes.

@jmartin-r7 jmartin-r7 merged commit f125e13 into rapid7:master Jan 13, 2018

2 checks passed

Metasploit Automation - Test Execution Successfully ran `autoPayloadTest.py`.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

jmartin-r7 added a commit that referenced this pull request Jan 13, 2018

@jmartin-r7 jmartin-r7 added the rn-fix label Jan 13, 2018

@jmartin-r7

This comment has been minimized.

Show comment
Hide comment
@jmartin-r7

jmartin-r7 Jan 13, 2018

Contributor

Release Notes

Fixed an issue with python meterpreter white space normalization.

Contributor

jmartin-r7 commented Jan 13, 2018

Release Notes

Fixed an issue with python meterpreter white space normalization.

@jmartin-r7 jmartin-r7 added the bug label Jan 13, 2018

@busterb

This comment has been minimized.

Show comment
Hide comment
@busterb

busterb Jan 18, 2018

Contributor

Ninja'd commit b4bb1b5 to fix a patchup issue with stageless python meterpreter

Contributor

busterb commented Jan 18, 2018

Ninja'd commit b4bb1b5 to fix a patchup issue with stageless python meterpreter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment