iagox86 / dnscat2

BSD 3-Clause "New" or "Revised" License
3.4k stars 599 forks source link

Ruby execution error: `proc': tried to create Proc object without a block (ArgumentError) #183

Closed sujitawake closed 1 year ago

sujitawake commented 1 year ago

I am coming across an error while running the dnscat2 server module on my Ubuntu.

Command

$ruby dnscat2.rb --dns "domain=domain.com,host=1.2.3.4"

Output

New window created: 0
New window created: crypto-debug
Welcome to dnscat2! Some documentation may be out of date.

/root/tools/c2/dnscat2/libs/swindow.rb:186:in `proc': tried to create Proc object without a block (ArgumentError)
        from /root/tools/c2/dnscat2/libs/swindow.rb:186:in `on_input'
        from /root/tools/c2/dnscat2/controller/controller.rb:30:in `initialize'
        from dnscat2.rb:116:in `new'
        from dnscat2.rb:116:in `<main>'

OS Environment

OS: Ubuntu 22.04.2 LTS
Ruby version: ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]

Any idea how to resolve this?

sujitawake commented 1 year ago

[Update]

Fixed the issue by installing the older version of ruby 2.7 using rbenv. But I am getting this error in a constant loop:

/root/tools/c2/dnscat2/tunnel_drivers/driver_dns.rb:316: warning: Capturing the given block using Kernel#proc is deprecated; use `&block` instead
/root/tools/c2/dnscat2/libs/dnser.rb:872: warning: Capturing the given block using Kernel#proc is deprecated; use `&block` instead

Any idea how to fix it?

sujitawake commented 1 year ago

Fixed the issue by applying the ruby code patches.