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

PWN::FFI::Stdio module - initial commit #564

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ gem 'jwt', '2.8.1'
gem 'libusb', '0.7.1'
gem 'luhn', '1.0.2'
gem 'mail', '2.8.1'
gem 'meshtastic', '0.0.1'
gem 'metasm', '1.0.5'
gem 'mqtt', '0.6.0'
# gem 'mongo', '2.19.3'
gem 'mongo', '2.20.0'
gem 'msfrpc-client', '1.1.2'
gem 'netaddr', '2.0.6'
gem 'net-ldap', '0.19.0'
Expand Down Expand Up @@ -84,7 +84,7 @@ gem 'ruby-nmap', '1.0.3'
gem 'ruby-saml', '1.16.0'
gem 'rvm', '1.11.3.9'
gem 'savon', '2.15.0'
gem 'selenium-devtools', '0.123.0'
gem 'selenium-devtools', '0.124.0'
gem 'serialport', '1.3.2'
# gem 'sinatra', '4.0.0'
gem 'slack-ruby-client', '2.3.0'
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $ cd /opt/pwn
$ ./install.sh
$ ./install.sh ruby-gem
$ pwn
pwn[v0.5.84]:001 >>> PWN.help
pwn[v0.5.87]:001 >>> PWN.help
```

[![Installing the pwn Security Automation Framework](https://raw.githubusercontent.com/0dayInc/pwn/master/documentation/pwn_install.png)](https://youtu.be/G7iLUY4FzsI)
Expand All @@ -52,7 +52,7 @@ $ rvm use ruby-3.3.0@pwn
$ gem uninstall --all --executables pwn
$ gem install --verbose pwn
$ pwn
pwn[v0.5.84]:001 >>> PWN.help
pwn[v0.5.87]:001 >>> PWN.help
```

If you're using a multi-user install of RVM do:
Expand All @@ -62,7 +62,7 @@ $ rvm use ruby-3.3.0@pwn
$ rvmsudo gem uninstall --all --executables pwn
$ rvmsudo gem install --verbose pwn
$ pwn
pwn[v0.5.84]:001 >>> PWN.help
pwn[v0.5.87]:001 >>> PWN.help
```

PWN periodically upgrades to the latest version of Ruby which is reflected in `/opt/pwn/.ruby-version`. The easiest way to upgrade to the latest version of Ruby from a previous PWN installation is to run the following script:
Expand Down
2 changes: 1 addition & 1 deletion lib/pwn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module PWN
autoload :SAST, 'pwn/sast'
autoload :WWW, 'pwn/www'

# Display Usage for the PWN Framework ~
# Display a List of Every PWN Module

public_class_method def self.help
constants.sort
Expand Down
2 changes: 1 addition & 1 deletion lib/pwn/aws.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ module AWS
autoload :Workspaces, 'pwn/aws/workspaces'
autoload :XRay, 'pwn/aws/x_ray'

# Display a List of Every PWN Plugin
# Display a List of Every PWN::AWS Module

public_class_method def self.help
constants.sort
Expand Down
4 changes: 2 additions & 2 deletions lib/pwn/ffi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module PWN
# into memory only when they're needed. For more information, see:
# http://www.rubyinside.com/ruby-techniques-revealed-autoload-1652.html
module FFI
# autoload :Sock, 'pwn/ffi/sock'
autoload :Stdio, 'pwn/ffi/stdio'

# Display a List of Every PWN Report
# Display a List of Every PWN::FFI Module

public_class_method def self.help
constants.sort
Expand Down
41 changes: 41 additions & 0 deletions lib/pwn/ffi/stdio.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# frozen_string_literal: true

require 'ffi'

PubFFI = FFI
module PWN
module FFI
# This plugin is a wrapper for the standard I/O functions in libc.
module Stdio
extend PubFFI::Library

ffi_lib PubFFI::Library::LIBC

attach_function(:puts, [:string], :int)
attach_function(:printf, %i[string varargs], :int, convention: :default)
attach_function(:scanf, %i[string varargs], :int)

# Author(s):: 0day Inc. <request.pentest@0dayinc.com>

public_class_method def self.authors
"AUTHOR(S):
0day Inc. <request.pentest@0dayinc.com>
"
end

# Display Usage for this Module

public_class_method def self.help
puts "USAGE:
#{self}.puts string
#{self}.printf(\"format string\", str, int, etc)

scanf_buffer = FFI::MemoryPointer.new(:char, 100)
#{self}.scanf(\"format string\", scanf_buffer)

#{self}.authors
"
end
end
end
end
3 changes: 1 addition & 2 deletions lib/pwn/plugins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ module Plugins
autoload :JSONPathify, 'pwn/plugins/json_pathify'
autoload :Log, 'pwn/plugins/log'
autoload :MailAgent, 'pwn/plugins/mail_agent'
autoload :Meshtastic, 'pwn/plugins/meshtastic'
autoload :Metasploit, 'pwn/plugins/metasploit'
autoload :MonkeyPatch, 'pwn/plugins/monkey_patch'
autoload :MSR206, 'pwn/plugins/msr206'
Expand Down Expand Up @@ -75,7 +74,7 @@ module Plugins
autoload :Vsphere, 'pwn/plugins/vsphere'
autoload :XXD, 'pwn/plugins/xxd'

# Display a List of Every PWN Plugin
# Display a List of Every PWN::Plugins Module

public_class_method def self.help
constants.sort
Expand Down
Loading