Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jameshilliard on github.
  • I am jameshilliard (https://keybase.io/jameshilliard) on keybase.
  • I have a public key ASBOoeTrgtofuFyKM4kZ93ONGzC3EVdR5WeKl_puDvbGNwo

To claim this, I am signing this object:

@jameshilliard
jameshilliard / decrypt.py
Last active October 9, 2019 20:51 — forked from laanwj/decrypt.py
Decrypt router configuration
#!/usr/bin/env python3
# W.J. van der Laan 2017, distributed under MIT license
import binascii
import base64
import struct
import json
import os, sys
from Crypto import Random
from Crypto.Cipher import AES
known_outdated_fw = ["Linux antMiner 3.10.12 #10 Thu Dec 26 09:03:53 CST 2013 mips GNU/Linux" => "antMiner_openwrt20131226.bin"]
error:
firmware.rb:20:in `block in <main>': undefined method `known_outdated_fw' for main:Object (NoMethodError)
from /Users/jameshilliard/.rvm/gems/ruby-2.1.1/gems/net-ssh-2.8.0/lib/net/ssh.rb:208:in `start'
from firmware.rb:14:in `<main>
require 'net/scp'
require 'net/ssh'
require 'timeout'
require 'net/ping'
ipaddress = ARGV[0]
current_ip = ipaddress
fw_latest = "Linux antMiner 3.10.12 #2 Fri Feb 7 18:50:12 CST 2014 mips GNU/Linux"
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'lan'
option ifname 'eth0'
option type 'bridge'
Net::SSH.start(ipaddress, "root", :password => "root") do |ssh|
puts "reloading network interface"
begin
Timeout::timeout(network_reload_timeout) do
ssh.exec!("/etc/init.d/network reload")
end
rescue Timeout::Error
puts "connection closed from network change"
ssh.shutdown!()
end
cap production deploy --trace
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke deploy (first_time)
** Execute deploy
** Invoke deploy:starting (first_time)
** Execute deploy:starting
** Invoke deploy:check (first_time)
src/gz barrier_breaker http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay
<div id="sushi-review">
<style type="text/css">
#sushi-review{
font-size: 20px;
min-width: 700px;
/*height: 80px;*/
background-color: #f7931a;
font-family: 'Roboto Condensed', helvetica, sans-serif;
}
from pysnmp.entity.rfc3413.oneliner import cmdgen
def MACPORT(ipaddress):
cmdGen = cmdgen.CommandGenerator()
community = 'public'
errorIndication, errorStatus, errorIndex, MacTable = cmdGen.nextCmd(
cmdgen.CommunityData(community),
cmdgen.UdpTransportTarget((ipaddress, 161)),
'1.3.6.1.2.1.17.4.3.1.1',
)