Skip to content

Instantly share code, notes, and snippets.

@rqu1
rqu1 / checkmk.py
Last active August 4, 2024 16:42
check if a PAN firewall is using the default master key when globalprotect is enabled
from hashlib import md5, sha1
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
from base64 import b64encode, b64decode
import sys, time
import requests
DEFAULT_MASTERKEY=b'p1a2l3o4a5l6t7o8'
class PanCrypt():
@colin-stubbs
colin-stubbs / pan_rsyslog_rb.py
Last active June 5, 2021 09:23 — forked from jtschichold/pan_rsyslog_rb.py
Generate mmnormalize rulebase for Palo Alto Networks NGFW logs
THREAT_FIELDS_5_0 = ["future_use1","receive_time","serial_number","@THREAT","log_subtype","future_use2",
"generated_time","src_ip","dest_ip","src_translated_ip","dest_translated_ip","rule","src_user",
"dest_user","app","virtual_system","src_zone","dest_zone","src_interface","dest_interface",
"log_forwarding_profile","future_use3","session_id","repeat_count","src_port","dest_port",
"src_translated_port","dest_translated_port","flags","protocol","action","misc","threat_name",
"category","severity","direction","sequence_number","action_flags","src_location","dest_location",
"future_use4","content_type"]
THREAT_FIELDS_6_0 = THREAT_FIELDS_5_0 + ["pcap_id", "url_idx", "cloud_address"]
@cdhunt
cdhunt / Get-CredentialFromWindowsCredentialManager.ps1
Last active September 4, 2024 19:46 — forked from toburger/Get-CredentialFromWindowsCredentialManager.ps1
Gets a PowerShell Credential [PSCredential] from the Windows Credential Manager. This only works for Generic Credentials.
<#
.SYNOPSIS
Gets a PowerShell Credential (PSCredential) from the Windows Credential Manager
.DESCRIPTION
This module will return a [PSCredential] object from a credential stored in Windows Credential Manager. The
Get-StoredCredential function can only access Generic Credentials.
Alias: GSC
require 'rubygems'
require 'softlayer_api'
$SL_API_USERNAME = "" # enter your username here
$SL_API_KEY = ""
virtual_guest_service = SoftLayer::Service.new("SoftLayer_Virtual_Guest")
begin
templateObject = {
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

// Order a monthly billed Bare Metal Computing instance.
//
// Build a SoftLayer_Container_Product_Order_Hardware_Server object for a new
// Bare Metal Cloud (BMC) order and pass it to the SoftLayer_Product_Order API
// service to order it. In this care we'll order a 4 core instance with 16G
// RAM, 1000mbit NICs, 2000GB bandwidth, a 250G SATA drive, Windows 2008 R2
// Datacenter edition (64-bit) with Hyper-V, and default server order options.
// See below for more details.
//
// Backend code to call the SoftLayer API was generated with the wsdl.exe
@henrik
henrik / yamlator.rb
Created February 3, 2010 12:54
Helps you update Rails i18n YAML files programmatically.
# YAMLator by Henrik Nyh <http://henrik.nyh.se> 2010-02-03 under the MIT license.
# Helps you update Rails i18n YAML files programmatically, to be used e.g. for
# editor extraction tools.
$KCODE = 'u'
require "yaml"
require "rubygems"
require "ya2yaml" # Dumps with unescaped UTF-8.
@tomlea
tomlea / gist:207938
Created October 11, 2009 22:55
This is very rough and ready.
require "net/http"
# Example Usage:
#
# use Rack::Proxy do |req|
# if req.path =~ %r{^/remote/service.php$}
# URI.parse("http://remote-service-provider.com/service-end-point.php?#{req.query}")
# end
# end
#