Skip to content

Instantly share code, notes, and snippets.

View arizvisa's full-sized avatar
🖕

Ali Rizvi-Santiago arizvisa

🖕
  • Everything here is BSD Licensed unless specified otherwise.
View GitHub Profile
@arizvisa
arizvisa / ss-telefrag.py
Created June 21, 2023 19:57
random python code
if __name__ == 'TELEFRAG':
import math, random, ptypes, office.storage
from ptypes import *
source = ptypes.provider.file(rp, 'rw')
source = ptypes.setsource(source)
state = random.Random()
## file
store = office.storage.File()
@arizvisa
arizvisa / internal.interface.py
Created March 5, 2023 07:15
internal.name.typeref for temporary renaming unparsable type declaration.
diff --git a/misc/interface.py b/misc/interface.py
index 4a9504fe5..94b77514b 100644
--- a/misc/interface.py
+++ b/misc/interface.py
@@ -6107,3 +6107,42 @@ class name(object):
logging.fatal(u"{:s}.netnode({:#x}{:s}) : Unable to restore the original name (\"{:s}\") for the netnode at {:#x} which is currently named \"{:s}\".".format('.'.join([__name__, cls.__name__]), identifier, '' if name is None else ", name=\"{:s}\"".format(name), internal.utils.string.escape(original, '"'), identifier, internal.utils.string.escape(temporary, '"')))
logging.info(u"{:s}.netnode({:#x}{:s}) : The original name (\"{:s}\") is currently associated with the netnode at {:#x}.".format('.'.join([__name__, cls.__name__]), identifier, '' if name is None else ", name=\"{:s}\"".format(name), internal.utils.string.escape(original, '"'), internal.netnode.get(original)))
return
+
+ @classmethod
@arizvisa
arizvisa / vcenter-authentication-policies.patch
Last active March 3, 2023 02:20
remove all stupid authentication-related polices from vcenter
--- /dev/null 2023-02-27 00:26:22.135999836 +0000
+++ /etc/pam.d/system-account- 2022-11-08 08:17:09.000000000 +0000
@@ -0,0 +1,7 @@
+# Begin /etc/pam.d/system-account
+# Updated by Ansible - 2022-11-08T08:17:09.196506
+
+account required pam_unix.so
+account required pam_tally2.so deny=3 onerr=fail audit even_deny_root unlock_time=900 root_unlock_time=300
+
+# End /etc/pam.d/system-account
@arizvisa
arizvisa / nested.py
Created February 21, 2023 02:14
modification of nested characters or tokens
def indices(string, characters):
'''Return a generator that yields each index of the given `characters` found in `string`.'''
iterable = (string.find(character) for character in characters)
current, index = 0, min([index for index in iterable if 0 <= index] or [-1])
while 0 <= index:
yield current + index
current, string = current + 1 + index, string[1 + index:]
iterable = [string.find(character) for character in characters]
index = min([index for index in iterable if 0 <= index] or [-1])
return
@arizvisa
arizvisa / blabla.py
Last active February 9, 2024 19:16
shirtz
# gen_key returns privkey as bytes and pem
# load_key will read a key from some bytes (decrypting if a pass is provided), asking user for input, returning privkey as bytes and pem
# gen_certificate takes your private key as bytes and some keywords, returning a cert and pubkey
# load_certificate takes private key and cert as bytes, returning a cert and pubkey
# setup_ssl is just example code how to use those things
def gen_key(e=65537, bits=1024):
import cryptography.hazmat.primitives.asymmetric.rsa as chpar
import cryptography.hazmat.primitives.serialization as chps
import cryptography.hazmat.backends as chb
@arizvisa
arizvisa / multicase.py
Last active December 26, 2022 21:43
constraints with some fixes and some better scoring for performance testing
class multicase(object):
"""
A lot of magic is in this class which allows one to define multiple cases
for a single function.
"""
CO_OPTIMIZED = 0x00001
CO_NEWLOCALS = 0x00002
CO_VARARGS = 0x00004
CO_VARKEYWORDS = 0x00008
CO_NESTED = 0x00010
@arizvisa
arizvisa / ctree-tag-lexer.py
Last active September 14, 2022 21:30
practically useless ctree shiz
F = idaapi.decompile(address)
def ctree_relexer(F, idabits=8 if idaapi.get_inf_structure().is_64bit() else 4):
iterable = (F.pseudocode[i].line for i in range(1 + F.hdrlines, F.pseudocode.size()))
items = ' '.join(iterable).split("\x01({:0{:d}s}".format('', 2 * idabits))
line, = filter(None, items)
for m in re.finditer(r"\x01\(([0-9A-F]{{{:d}}})[\1\2]([^\1\2]+)".format(2 * idabits), line):
id, x = m.groups()
idx = int(id, 0x10)
if F.treeitems.size() <= idx: continue
@arizvisa
arizvisa / mppc.py
Created October 6, 2021 00:30
RFC2118 (found in an old home directory)
import ptypes
from ptypes import *
from ptypes.bitmap import RBitmap, WBitmap
import six, array, math
class Encode(object):
@classmethod
def byte(cls, wb, by):
if by & 0x80:
@arizvisa
arizvisa / vincenthEE-DotEditor-v0.3.1.patch
Created November 5, 2020 02:33
vincenthEE/DotEditor/tree/v0.3.1
diff --git a/DEUtils.py b/DEUtils.py
index 90c781e..542ee32 100644
--- a/DEUtils.py
+++ b/DEUtils.py
@@ -280,7 +280,8 @@ def normalize_imglist(image_list):
pos_y = int((max_h-h)/2)
new_img = wx.EmptyImage(max_w, max_h)
- new_img.Clear(0xff)
+ #new_img.Clear(0xff)
@arizvisa
arizvisa / developer-console-extensions.js
Created September 23, 2020 18:23
Developer Console Extensions (greasemonkey)
// ==UserScript==
// @name Developer Console Extensions
// @description This adds a number of utilities to the developer console object
// @version 1
// @noframes
// @run-at document-end
// @grant none
// ==/UserScript==
/*