Skip to content

Instantly share code, notes, and snippets.

@marccane
marccane / parameterFilterMITM.sh
Created February 18, 2020 00:15
powerpc-linux-gnu-gcc
#!/bin/bash
pars=""
while (( "$#" )); do
if [[ $1 == "-fstack-protector-strong" ]]; then
echo "NOPE"
else
pars="$pars $1"
#!/usr/bin/env python3
#Checks if the solution of the tiles problem is valid
import sys
if len(sys.argv) != 3:
print("Usage: ", sys.argv[0], "<tilesProblemFile> <tilesSolutionFile>")
sys.exit(2)
f=open(sys.argv[1])
liniesTiles=f.readlines()
@marccane
marccane / steamMarketHistoryFilterByGameID.py
Last active January 24, 2023 21:46
steamMarketHistoryFilterByGameID.py
#!/bin/python
#quick 'n dirty script to filter market history by game id (csgo in this case)
#to get the data you go to https://steamcommunity.com/market/, f12, change page to request next batch of 10 results
#goto network mode, edit and resend request, put the starting index to 0 and count to ~300
#if you request too much the server throws an error. Finally you copy the contents of the response message which is a json
#and name it 1.json. If you have more than 300 results which is likely, you'll have to make multiple queries, changing the index appropiately
#and naming the next files 2.json... You also have to modify the code if you have more than 2 files
#Only the name of the item is shown, as the price and other info seems to only be encoded in the html which is discarded right now
import json
@marccane
marccane / singleHandWords.py
Last active October 9, 2022 13:27
This script prints all the words from the given dictionary file that can be written with a single hand in a spanish qwerty layout keyboard
#!/bin/python3
#This script prints all the words from the given dictionary file that can be written with a single hand in a (spanish) qwerty layout keyboard (using only half of the keyboard)
#The dictionary file used (ca.dic) used has been extracted from the open office ca.3.0.5.oxt dictionary file (which is just a zip file)
#Requisites: python-unidecode
#Parameters
minimumWordLength = 3
import sys
#!/bin/python
import functools
a=[0x45481d1217111313,0x95f422c260b4145,0x541b56563d6c5f0b,0x585c0b3c2945415f,0x402a6c54095d5f00,0x4b5f4248276a0606,0x6c5e5d432c2d4256,0x6b315e434707412d,0x5e54491c6e3b0a5a,0x2828475e05342b1a,0x60450073b26111f,0xa774803050b0d04]
b=functools.reduce(lambda x, y: x+y, map(lambda x: x.to_bytes(8,"little"), a))
res=[0]*len(b)
tmp = 0
for i in range(len(b)-1,-1,-1):
tmp = res[i] = b[i] ^ tmp
@marccane
marccane / extractPicaShaders.py
Last active April 2, 2022 15:50
Script to extract 3DS PICA200 shaders from (decrypted) binaries which can then be disassembled with aemstro or nihstro. Should work on anything like .cia .3ds .3dsx... Writes each shader in a .shbin file in the current directory.
#!/bin/python3
#https://problemkaputt.de/gbatek-3ds-files-video-shaders-dvlb-and-dvob-format.htm
import sys, mmap, struct as s
magic = b"DVLB"
magicDVLE = b'DVLE'
magicDVLEInt = s.unpack("<I", magicDVLE)[0]
def ph(v):
print(hex(v))
def readInt(mm, base, idx):
start = base+idx*4
@marccane
marccane / pwnableScrapper.py
Last active December 6, 2022 01:07
pwnable.tw challenge sorter
#!/usr/bin/env python3
#import sys, requests, code
from lxml import etree
#code.interact(local=locals())
baseUrl = "https://pwnable.tw/challenge/"
if __name__ == '__main__':
arr = []
with open("pwnable.tw.html") as file:
@marccane
marccane / githubStarsScrapper.sh
Last active December 6, 2022 22:15
Dirty & ugly bash+curl+grep+cut+rev+xargs+python+tee+sort oneliner to extract github urls, extract the repo stars and sort them by number of stars
time curl -s https://raw.githubusercontent.com/wspace/corpus/main/README.md |
grep -Eo "\[GitHub\]\(https://github\.com[0-9a-zA-Z/#-~]+\)" |
cut -c 10- | rev | cut -c 2- | rev |
xargs -I % sh -c "echo -n %; wget -q -O /tmp/out.tmp %; python -c \"from lxml import etree;a=etree.HTML(open('/tmp/out.tmp').read()).xpath('//span[@class={0}Counter js-social-count{0}]'.format(chr(39)))[0].text;b=a.replace('.','').replace('k','00') if a.find('k')!=-1 else a;print(' '+b)\"" |
tee /dev/stderr |
sort -t ' ' -k2n
@marccane
marccane / miravia_tramuntanaStore.py
Last active January 24, 2023 21:43
Quick script to scrap all products from a miravia.es virtual shop with pickle cache file to quickly change the search filter or sorting parameters
#!/usr/bin/env python3
import http.client, sys, json, traceback, pickle, os
from os.path import exists
productNameFilter = "monster"
def loadItemsFromWeb():
itemsBuffer = []
conn = http.client.HTTPSConnection("www.miravia.es")
for pageNumber in range(1,22):
@marccane
marccane / sublimeBlogAuthorParser.sh
Created April 9, 2024 10:23
Linux oneliner to get the authors of the sublime text articles. Uses curl, grep, awk and xargs.
#!/bin/bash
curl -s https://www.sublimetext.com/blog/articles/2021/03 | grep -o "/blog/articles/[0-9][0-9][0-9][0-9]/[0-9][0-9]" | awk '{print "https://www.sublimetext.com" $0}' | xargs curl -s | grep '"author">'