Skip to content

Instantly share code, notes, and snippets.

View junquera's full-sized avatar
🐈‍⬛

Javier Junquera Sánchez junquera

🐈‍⬛
View GitHub Profile
@junquera
junquera / brute_caesar.sh
Created April 9, 2020 09:18
Brute Caesar rahash2
for i in $(seq 1 26); do
echo "$i:" $(printf "$1" | rahash2 -D rot -S s:$i -s -);
done
@junquera
junquera / UserController.java
Created March 11, 2020 06:36
Spring basic serialization example
import io.junquera.ca.back.entities.User;
import org.json.JSONObject;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class LogController {
@junquera
junquera / onion_from_pub.py
Created January 17, 2020 23:04
Onion from public key
import hashlib
import base64
from Crypto.PublicKey import RSA
import sys
# U=$(openssl rsa -in a.pem -pubout -outform DER | tail -c +23 | shasum | head -c 20 | python -c "import base64,sys; print base64.b32encode(sys.stdin.readline().strip('\n').decode('hex')).lower()"); echo "http://${U}.onion"
with open(sys.argv[1]) as f:
pem = f.read()
@junquera
junquera / imprime.sh
Created June 7, 2019 08:18
Imprimir mensaje en impresora de red
PRINTER_IP="$1"
MESSAGE="$2"
echo $MESSAGE | nc $PRINTER_IP 9100
@junquera
junquera / html_tags.txt
Created April 8, 2019 08:55
All html tags
a
abbr
acronym
address
and
applet
area
article
aside
audio
@junquera
junquera / gen.py
Last active February 11, 2019 13:02
Generación de hashes
import hashlib
def sha1(i):
return hashlib.sha1(i).hexdigest()
def scrypt(i, sal):
'''
n = CPU/memory cost parameter
r = tamaño del bloque
p = paralelización
@junquera
junquera / ellip_op.py
Created January 28, 2019 15:37
Suma de puntos de curvas elípticas
import math
class Punto():
def __init__(self, x, y):
self.x = x
self.y = y
def __cmp__(self, other):
return math.sqrt((self.x - other.x)**2 + (self.y - other.y)**2)
@junquera
junquera / affine.py
Last active December 17, 2018 20:39
Análisis estadístico de texto cifrado por sustitución monoalfabética
l = ord('Z') - ord('A') + 1
def inverso(x, m):
for i in range(m):
r = (x * i) % m
if r == 1:
return i
return 0
#!/usr/bin/env python3
t = '''
VAQG  JYHN  QGTR  YNOQ  AEXM  TRZR  QQAU  QAQQ  XQZQ  YUSA  QEFM  QZXM  OUGP  MP
'''
i = ord('A')
f = ord('Z')
r = (f + 1) - i
l = list("".join(t.split()))
import miniupnpc
upnp = miniupnpc.UPnP()
upnp.discover()
upnp.selectigd()
port = 80
upnp.addportmapping(port, 'TCP', upnp.lanaddr, port, 'testing', '')