Skip to content

Instantly share code, notes, and snippets.

View ctrl-freak's full-sized avatar

Bryce Sheehan ctrl-freak

View GitHub Profile
@ctrl-freak
ctrl-freak / android-adb-pull-apk.md
Last active March 15, 2025 11:52
Retrieve APK from Non-Rooted Android Device through ADB

https://stackoverflow.com/a/18003462/348146

None of these suggestions worked for me, because Android was appending a sequence number to the package name to produce the final APK file name (this may vary with the version of Android OS). The following sequence of commands is what worked for me on a non-rooted device:

  1. Determine the package name of the app, e.g. com.example.someapp. Skip this step if you already know the package name.

    adb shell pm list packages

    Look through the list of package names and try to find a match between the app in question and the package name. This is usually easy, but note that the package name can be completely unrelated to the app name. If you can't recognize the app from the list of package names, try finding the app in Google Play using a browser. The URL for an app in Google Play contains the package name.

@ctrl-freak
ctrl-freak / apk_zipalign_resign.md
Created July 24, 2020 02:01
Modifying Android APK and Resign on Windows
@ctrl-freak
ctrl-freak / purestorage-hdparm-secure-erase.sh
Created October 1, 2023 11:55
Clear ATA Security Lock (Encryption) on ex-Pure Storage array drives
# Done successfully on a Toshiba THNSNJ512GCSY
# WARNING: ALL DATA ON THE DRIVE WILL BE LOST; DON'T DO THIS UNLESS YOU KNOW ITS WHAT YOU NEED
# This is a series of shell commands, not a functional script
# Once unlocked, the drive should be able to be initialized/MBR written and partitions created.
sudo -s
# Identify drives
lsblk
@ctrl-freak
ctrl-freak / html-purifier-config.php
Created September 2, 2011 08:02
HTML Purifier Configuration
<?
$purifier_config = HTMLPurifier_Config::createDefault();
$purifier_config->set('HTML.AllowedElements', 'p, a, ul, ol, li, h1, h2, h3, h4, h5, h6, br, strong, em, b, i');
$purifier_config->set('HTML.AllowedAttributes', '');
$purifier_config->set('CSS.AllowedProperties', '');
$purifier_config->set('AutoFormat.RemoveEmpty', true);
$purifier_config->set('AutoFormat.AutoParagraph', true);
// May cause problems with empty table cells and headers
@ctrl-freak
ctrl-freak / gatekeeper-webhook-nodejs.js
Last active April 8, 2024 07:41
Gatekeeper Webhook Challenge Response in NodeJS (on PipeDream)
// https://www.gatekeeperhq.com/
// The Vendor & Contract Lifecycle Management (VCLM) Platform
// Webhook 'documentation' on Settings page is for Ruby, incomplete and does not include that the crc_response is to be base64 encoded.
// Video on Knowledgebase contains Python script which shows this is the case:
// https://knowledge.gatekeeperhq.com/en/docs/webhooks
import * as crypto from "crypto";
export default defineComponent({
async run({ steps, $ }) {
@ctrl-freak
ctrl-freak / mirror-logins.sql
Created April 8, 2024 07:40
Generate SQL to create MSSQL logins with same SID and password
-- SQL Server Logins
select
'create login [' + sp.[name] + '] with password=0x' + CONVERT(nvarchar(max), l.password_hash, 2) + ' hashed, sid=0x' + convert(nvarchar(2000), sp.[sid], 2) + ', default_language = [us_english];'
from
master.sys.server_principals sp
inner join master.sys.sql_logins l on sp.[sid] = l.[sid]
where
sp.type_desc = 'SQL_LOGIN'
and sp.is_disabled = 0
and sp.default_language_name = 'us_english' -- helps target the specifically created logins
@ctrl-freak
ctrl-freak / gist:9abb5aea0d89d7bd9df6a3d0ac08b73c
Created November 2, 2016 01:18
Android ADB `adb shell input keyevent` Codes
// http://stackoverflow.com/questions/7789826/adb-shell-input-events
0 --> "KEYCODE_0"
1 --> "KEYCODE_SOFT_LEFT"
2 --> "KEYCODE_SOFT_RIGHT"
3 --> "KEYCODE_HOME"
4 --> "KEYCODE_BACK"
5 --> "KEYCODE_CALL"
6 --> "KEYCODE_ENDCALL"
7 --> "KEYCODE_0"
@ctrl-freak
ctrl-freak / removesophos.ps1
Created August 1, 2019 00:31
Sophos Endpoint Removal Script
# https://www.reddit.com/r/sysadmin/comments/ck677f/sophos_removal_script/
# https://pastebin.com/4eRc5WpA
#Sophos Endpoint Removal Script
#Usage examples:
# .\removesophos.ps1 # Just logs all messages to screen and file.
# .\removesophos.ps1 -Remove YES # Removes all Sophos components and logs all messages to screen and file.
# .\removesophos.ps1 -Password 1234567 -Remove YES # Password will be provided to SEDCli.exe if TP is on and SEDCLi.exe exists.
# .\removesophos.ps1 -ErrorOnly YES # Only print items that exist (errors) on screen. Still logs all to file.
@ctrl-freak
ctrl-freak / rtl8188eus.sh
Created July 15, 2020 02:19
TP-Link TL-WN722N v2 Monitor Mode
# https://github.com/aircrack-ng/rtl8188eus
sudo apt update
sudo apt install bc
sudo rmmod r8188eu.ko
git clone https://github.com/aircrack-ng/rtl8188eus
cd rtl8188eus
sudo -i
echo "blacklist r8188eu.ko" > "/etc/modprobe.d/realtek.conf"
exit
@ctrl-freak
ctrl-freak / nethunter_grouper-talapia.md
Last active October 26, 2023 20:25
Install Kali Nethunter on Nexus 7 (2012) (grouper, talapia)

Unsupported

The Nexus 7 (2012) tablet is no longer supported by Offensive Security; I didn't have any luck with kernel/kali distributions, so attempted upgrading.

Problems

  • Installing Open GApps slows the device to a crawl, haven't been able to install an app without the device freezing (though may need to let it sort itself out for longer)
  • Attempted to avoid GApps by installing a browser from APK (via adb)