Skip to content

Instantly share code, notes, and snippets.

View jfinstrom's full-sized avatar
💭
making stuff

James Finstrom jfinstrom

💭
making stuff
View GitHub Profile
#!/usr/bin/env python
# Copyright (c) 2014 James Finstrom.
# Copyright (c) 2014 Schmoozecom Inc
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation,
# advertising materials, and other materials related to such
# distribution and use acknowledge that the software was developed by Schmoozecom.
@jfinstrom
jfinstrom / webssh.py
Created May 20, 2014 20:33
My script to tunnel web ports when I ssh...
#!/usr/bin/env python
import subprocess
import sys
import os
from argparse import ArgumentParser
shellcmd='xterm -e'
parser = ArgumentParser()
parser.add_argument('--port', action='store', help='SSH port default 22')
<?php
class US_Federal_Holidays
{
private $year, $list;
const ONE_DAY = 86400; // Number of seconds in one day
function __construct($year = null, $timezone = 'America/Chicago')
{
try
{
@jfinstrom
jfinstrom / linux-explorer.sh
Last active August 17, 2024 07:54
linux-explorer script from unix consultants modified to collect asterisk stuff
#!/bin/bash
##############################################################################
#
#
# FILE : linux-explorer.sh
# Last Change Date : 3-06-2014
# Author(s) : Joe Santoro
# Date Started : 15th April, 2004
# Email : linuxexplo [ at ] unix-consultants.com
# Web : http://www.unix-consultants.com/examples/scripts/linux/linux-explorer
@jfinstrom
jfinstrom / config_gen.py
Created June 19, 2014 01:46
Config generator for dahdi in python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# rhino_genconf
VERSION = "svn"
# Copyright 2012 James Finstrom <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@jfinstrom
jfinstrom / asteriskPB2Json.py
Created July 10, 2014 20:09
Dump Asterisk Phonebook to json as an interchange format
#!/usr/bin/env python
import subprocess
import json
callerid = {}
speeddial = {}
p = subprocess.Popen(["asterisk", "-rx", "database show"], stdout=subprocess.PIPE)
out = p.communicate()
out = out[0].splitlines()
for line in out:
if line.startswith('/cidname'):
@jfinstrom
jfinstrom / hotel.py
Created July 25, 2014 15:49
For later reference.... This is my keep alive script to prevent the hotel wifi from dropping me in to a captive portal
#!/usr/bin/env python
import requests
data=[('res','login'),('value','1012'),('gw_addr','10.10.12.1'),('gw_port','2060'),('password','newspaper'),('submit', 'True')]
r = requests.post('http://192.168.182.1:2060/index.php?res=login&amp;gw_id=1012&amp;gw_address=10.10.12.1&amp;gw_port=2060&amp;gw_mac=00%3A15%3A6D%3AC9%3A46%3AA7&amp;username=&amp;password=&amp;mac=54%3A35%3A30%3A8c%3Ab2%3A83&amp;url=http%253A%252F%252Fallviewnetworksdb.com%252Flocalproject%252FpageV2%252F%253Fid%253D2056"', data=data)
@jfinstrom
jfinstrom / DuckDNS.py
Last active January 24, 2018 12:20
DuckDNS Updater.....
#!/usr/bin/env python
import requests
import sys
#************************************#
# User Serviceable Stuff #
#************************************#
TOKEN = 'YOUR TOKEN'
DOMAIN = 'YOURSUBDOMAIN'
DEBUG = False
## End of user serviceable stuff...
@jfinstrom
jfinstrom / astari.py
Created September 10, 2014 16:29
Snippit I use to poke around on the Asterisk ARI this changes based on endpoint and data model...
#!/usr/bin/env python
import requests
from requests.auth import HTTPBasicAuth
IPADD='192.168.0.32:8088/ari/'
ENDPOINT = 'events'
ARIUSER=''
ARIPASS=''
r = requests.get('http://%s%s' % (IPADD,ENDPOINT),auth=HTTPBasicAuth(ARIUSER,ARIPASS))
@jfinstrom
jfinstrom / hash.py
Created September 29, 2014 18:44
Passing thought on hash reversal of simple hashes.
#!/usr/bin/env python
import hashlib
import sys
m = hashlib.md5()
for x in range(1000,9999):
ext = str(x)
m.update(ext+":asterisk:"+ext)
if m.hexdigest() == sys.argv[1]:
print ext
print m.hexdigest()