Skip to content
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

Handle error conditions better #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

kost
Copy link
Contributor

@kost kost commented Dec 5, 2018

Display stack trace, but do not fail and exit
(losing shells can be nightmare)

For example, dnscat2 server fails with following error messages on long running servers:

Caught an error: DNS packet was truncated (or we messed up parsing it)!
/pentest/dnscat2/server/libs/dnser.rb:179:in unpack' /pentest/dnscat2/server/libs/dnser.rb:634:in parse'
/pentest/dnscat2/server/libs/dnser.rb:849:in block (2 levels) in on_request' /pentest/dnscat2/server/libs/dnser.rb:843:in loop'
/pentest/dnscat2/server/libs/dnser.rb:843:in `block in on_request'

Protocol exception caught in dnscat DNS module (for more information, check window 'dns1'):
#<DnscatException: Received a packet with no questions>
Caught an error: undefined method serialize' for nil:NilClass /pentest/dnscat2/server/libs/dnser.rb:678:in block in serialize'
/pentest/dnscat2/server/libs/dnser.rb:677:in each' /pentest/dnscat2/server/libs/dnser.rb:677:in serialize'
/pentest/dnscat2/server/libs/dnser.rb:819:in reply!' /pentest/dnscat2/server/libs/dnser.rb:775:in error!'
/pentest/dnscat2/server/tunnel_drivers/driver_dns.rb:357:in rescue in block in initialize' /pentest/dnscat2/server/tunnel_drivers/driver_dns.rb:293:in block in initialize'
/pentest/dnscat2/server/libs/dnser.rb:879:in block (2 levels) in on_request' /pentest/dnscat2/server/libs/dnser.rb:843:in loop'
/pentest/dnscat2/server/libs/dnser.rb:843:in block in on_request' /pentest/dnscat2/server/libs/dnser.rb:883:in rescue in block (2 levels) in on_request': undefined method response_template' for #<DNSer::Transaction:0x0000000000dd6a58> (NoMethodError) Did you mean? respond_to? from /pentest/dnscat2/server/libs/dnser.rb:878:in block (2 levels) in on_request'
from /pentest/dnscat2/server/libs/dnser.rb:843:in loop' from /pentest/dnscat2/server/libs/dnser.rb:843:in block in on_request'

Display stack trace, but do not fail and exit
(losing shells can be nightmare)
@iagox86
Copy link
Owner

iagox86 commented Dec 5, 2018 via email

@kost
Copy link
Contributor Author

kost commented Dec 6, 2018

Regarding client in C, i have few patches to retry connection. They are bit hacky, but I will make pull request anyway, so feel free to decide what you want with it.

@iagox86
Copy link
Owner

iagox86 commented Dec 6, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants