Skip to content

Instantly share code, notes, and snippets.

View bka's full-sized avatar

Bernhard bka

View GitHub Profile
@bka
bka / msfconsole_snippet.rb
Created March 16, 2011 10:04
How to send commands to an existing metasploit framework instance
# init console with metasploit framwork
@console = Msf::Ui::Web::WebConsole.new(@framework,1)
# used to exec a command like it would be typed into msfconsole
def cmd_send_to_terminal cmd
@console.execute(cmd)
return @[email protected]
end
# used to interact with an open meterpreter session
@bka
bka / gist:872279
Created March 16, 2011 10:12
websocket client example
require 'rubygems'
require 'em-http-request'
require 'active_support'
EventMachine.run {
$http = EventMachine::HttpRequest.new("ws://localhost:8080/").get :timeout => 0
$http.errback { |e| puts "oops #{e}" }
$http.callback {
puts "WebSocket connected!"
@bka
bka / deploy.rb
Created March 16, 2011 10:15
Sample Capistrano deloyment config
set :application, "....."
set :deploy_to, "......"
set :scm, :subversion
set :deploy_via, :checkout
set :user, "SECRET"
set :password, "SECRECT"
set :use_sudo, true
set :svn_user, "SECRECT"
@bka
bka / gist:872285
Created March 16, 2011 10:20
get current svn revision
# From http://ariejan.net/2006/12/13/show-the-current-svn-revision-in-your-rails-app/
def get_revision
return `svn info #{RAILS_ROOT} | grep ^Revision`
end
@bka
bka / gist:872292
Created March 16, 2011 10:28
check if a webserver is reachable, if not send an email, can be used via cron...
require 'rubygems'
require 'action_mailer'
require 'mechanize'
# Delivery
SENDER_MAIL = "[email protected]"
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "mail.gmx.de",
:port => 25,
@bka
bka / gist:876023
Created March 18, 2011 12:57
metasploit callbacks sample on_ui_command and on_module_run
module Msf
module Ui
module Console
class Driver < Msf::Ui::Driver
alias_method :old_unknown_command, :unknown_command
def unknown_command(method, line)
self.on_command_proc.call(line.strip) if self.on_command_proc
old_unknown_command(method,line)
end
@bka
bka / bin magento error
Created December 19, 2015 11:06
Magento2: Copy Paste Error in Module name
$ bin/magento
We're sorry, an error occurred. Try clearing the cache and code generation directories. By default, they are: var/cache, var/di, var/generation, and var/page_cache.
[Zend\ServiceManager\Exception\ServiceNotCreatedException]
An abstract factory could not create an instance of magentosetupconsolecommandmoduleuninstallcommand(alias: Magento\Setup\Console\Command\ModuleUninstallC
ommand).
[Zend\ServiceManager\Exception\ServiceNotCreatedException]
An exception was raised while creating "Magento\Setup\Console\Command\ModuleUninstallCommand"; no instance returned
[Magento\Framework\Exception\FileSystemException]
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$directoryReader = $objectManager->create("\Magento\Framework\Module\Dir\Reader");
$moduleDirectory = $directoryReader->getModuleDir('', 'Vendor_Modulename');
echo "directory of module is ".$moduleDirectory;
XDEBUG_CONFIG="idekey=PHPSTORM" php -dxdebug.remote_host=192.168.56.1 -dxdebug.remote_enable=on -f bin/magento setup:upgrade