Skip to content

Instantly share code, notes, and snippets.

@drygdryg
drygdryg / mingw.patch
Created Apr 9, 2021
Patch to cross-compile Masscan under MinGW
View mingw.patch
diff --git a/Makefile b/Makefile
index 8265d5e..00eebe0 100644
--- a/Makefile
+++ b/Makefile
@@ -49,8 +49,8 @@ endif
# intended environment, so it make break in the future.
ifneq (, $(findstring mingw, $(SYS)))
INCLUDES = -Ivs10/include
-LIBS = -L vs10/lib -lIPHLPAPI -lWs2_32
-FLAGS2 = -march=i686
@drygdryg
drygdryg / iwextract.py
Created Mar 29, 2021
Extract info about a single access point from iw scan output
View iwextract.py
#!/usr/bin/env python3
import subprocess
import sys
import re
BSS_PATTERN = re.compile(r'BSS (\S+)( )?\(on \w+\)')
if __name__ == '__main__':
if len(sys.argv) != 3:
print(f"Usage: {sys.argv[0]} <interface> <bssid>")
View config.nims
from macros import error, hint
from os import `/`, splitFile
import strutils
import distros
when defined(release):
switch("checks", "off")
switch("assertions", "off")
switch("debuginfo", "off")
switch("stackTrace", "off")
@drygdryg
drygdryg / test.nim
Created Jan 2, 2021
protobuf-nim bug
View test.nim
import streams
import protobuf
parseProtoFile("test.proto")
var msg = new Example
msg.field1 = @[]
let exampleNested = initExample_ExampleNested()
exampleNested.field1 = initExample_ExampleNested_ExampleNested2(field1 = "Test", field2 = @[])
let exampleNested3 = initExample_ExampleNested_ExampleNested2_ExampleNested3(field1 = "Test")
@drygdryg
drygdryg / test.nim
Created Dec 31, 2020
nim-protobuf-bug
View test.nim
import streams
import protobuf
const protoSpec = """
syntax = "proto3";
message Example2 {
string field1 = 1;
int32 field2 = 2;
}
@drygdryg
drygdryg / gist:8088634f7dd6666df07b920657e39c15
Created Nov 28, 2020
Краткие сведения о драйверах USB Wi-Fi адаптеров в Linux
View gist:8088634f7dd6666df07b920657e39c15
Драйверы MediaTek:
- mt7601u (в ядре с версии 4.2): поддерживает режим ТД, мониторинга и инъекции
чипы: MT7601U, MT7601UN
- mt76 (в ядре с версии 4.19): поддерживает режим ТД, мониторинга и инъекции
чипы: MT7603E, MT7603EN, MT7610E, MT7610EN, MT7610U, MT7610UN, MT7612E, MT7612EN, MT7612U, MT7612UN, MT7615, MT7615E, MT7615N, MT7630E, MT7662E, MT7662EN, MT7628A, MT7628K, MT7628N
Драйверы Ralink:
- r2500usb (в ядре): поддерживает режим ТД, мониторинга и инъекции
чипы: RT2571W, RT2671
- rt2800usb (в ядре):поддерживает режим ТД, мониторинга и инъекции
@drygdryg
drygdryg / iw_wpa_supplicant_static.txt
Last active Aug 29, 2020
Сборка статично скомпонованных беспроводных утилит для Linux ARM (Android): iw и wpa_supplicant
View iw_wpa_supplicant_static.txt
Сборка статичного iw в Alpine:
# Установка базового инструментария для сборки
apk add build-base
mkdir iw_static
cd iw_static/
wget https://github.com/thom311/libnl/releases/download/libnl3_5_0/libnl-3.5.0.tar.gz
mkdir prefix
tar xvf libnl-3.5.0.tar.gz
cd libnl-3.5.0/
@drygdryg
drygdryg / srand.c
Last active Jul 7, 2020
A PRNG experiment
View srand.c
#include <stdio.h> /* printf, scanf */
#include <stdlib.h> /* srand, rand */
#include <time.h> /* time */
void manualSeed (void) {
int seed;
printf("Введите seed: ");
fflush(stdout);
scanf("%d", &seed);
srand(seed);
@drygdryg
drygdryg / rsmerge.nim
Last active Jul 7, 2020
Router Scan report files (CSV) merger
View rsmerge.nim
from os import walkFiles, paramStr, paramCount, tryRemoveFile
import csvtools
from strutils import join, toLowerAscii
import strformat
proc input(prompt: string = ""): string =
stdout.write(prompt)
stdout.flushFile()
result = stdin.readLine()
@drygdryg
drygdryg / wps_checksum.py
Created Jul 1, 2020
Validating and calculating WPS PIN checksum
View wps_checksum.py
# -*- coding: utf-8 -*-
def checksum(pin):
'''
Standard WPS checksum algorithm.
@pin — A 7 digit pin to calculate the checksum for.
Returns the checksum value.
'''
accum = 0
while pin:
accum += (3 * (pin % 10))