Skip to content

Instantly share code, notes, and snippets.

View amm0nite's full-sized avatar
🪐

Ambre Cavan amm0nite

🪐
View GitHub Profile
@amm0nite
amm0nite / wifi_ubuntu_18.md
Last active May 19, 2018 20:49
Wifi setup on Ubuntu Server 18.04

How to setup Wifi on Ubuntu Server 18.04

Create netplan config file

nano /etc/netplan/60-my-wifi.yaml

network:
  wifis:
    wlp5s0:
      dhcp4: true
 optional: true
@amm0nite
amm0nite / index.js
Created June 15, 2017 13:09
JWT Signature
const jwt = require('jsonwebtoken');
const CryptoJS = require('crypto-js');
const secret = 'secret';
const payload = {
iss: 'issuer',
sub: 'subject',
exp: (Date.now() / 1000) + 3600,
iat: Date.now(),
};
@amm0nite
amm0nite / install_mitmproxy.md
Last active January 23, 2017 09:58
Install mitmproxy

Ubuntu 14.04

apt-get install libffi-dev libssl-dev libtiff5-dev libjpeg8-dev zlib1g-dev libwebp-dev

wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
tar zxvf Python-3.6.0.tgz
cd Python-3.6.0 && ./configure && make && make install

pip3.6 install -U pip
@amm0nite
amm0nite / Program.cs
Created April 17, 2015 14:02
Ping LAN hosts
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.Sockets;
using System.Net.NetworkInformation;
@amm0nite
amm0nite / Sprite.cs
Last active December 21, 2015 01:09
Unity simple 2D sprite class
using UnityEngine;
public class Sprite {
private static int count = 0;
private static int minSize = 8;
private static Mesh mesh;
private static Material atlas;
private GameObject gameObject;
@amm0nite
amm0nite / password.php
Last active December 18, 2015 13:39
PHP password hashing
<?php
/**
* chaîne de caractères aléatoire
* @param number $length
* @return string
*/
function _random($length=8) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$string = '';
for ($i = 0; $i < $length; $i++) {
@amm0nite
amm0nite / EncryptedMessage.java
Last active December 16, 2015 04:48
Cryptographie asymétrique avec Java
import java.security.InvalidKeyException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
@amm0nite
amm0nite / rsa2.java
Last active December 16, 2015 04:49
Cryptographie asymétrique avec Java : RSA + Blowfish
KeyGenerator keyGenerator = KeyGenerator.getInstance("Blowfish");
keyGenerator.init(128);
SecretKey blowfishKey = keyGenerator.generateKey();
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(1024);
KeyPair keyPair = keyPairGenerator.genKeyPair();
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
cipher.init(Cipher.ENCRYPT_MODE, keyPair.getPublic());
@amm0nite
amm0nite / rsa1.java
Last active December 16, 2015 04:49
Cryptographie asymétrique avec Java : RSA simple
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(1024);
KeyPair keyPair = keyPairGenerator.genKeyPair();
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
byte[] plain = (new String("TEST")).getBytes("UTF-8");
cipher.init(Cipher.ENCRYPT_MODE, keyPair.getPublic());
byte[] encrypted = cipher.doFinal(plain);