Skip to content

Instantly share code, notes, and snippets.

View Job79's full-sized avatar

Job Job79

View GitHub Profile
@Job79
Job79 / djba2.cs
Last active January 23, 2022 18:55
djba2 implementation c#
public static int Hash(this string str)
{
int hash = 5381;
foreach (var t in str) hash = ((hash << 5) + hash) ^ (byte) t;
return hash;
}
@Job79
Job79 / wol.cs
Last active January 23, 2022 18:56
c# Wake On Lan example
/* WakeOnLan
* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2.
*/
using System.Net;
using System.Net.Sockets;
using System.Globalization;
@Job79
Job79 / keylogger.cs
Last active January 23, 2022 18:56
c# keylogger
/* KeyLogger
* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2.
*/
using System;
using System.IO;
using System.Runtime.InteropServices;
@Job79
Job79 / brainfuck.cs
Last active January 23, 2022 18:56
Small Brainfuck interpreter written in c#
static void Run(char[] c)
{
var s = new List<byte>{0};
int p = 0, bc = 0;
for (int i = 0; i < c.Length; i++)
{
if (c[i] == '>' && s.Count == ++p) s.Add(0);
else if (c[i] == '<') p--;
else if (c[i] == '+') s[p]++;
@Job79
Job79 / sshd_config
Created January 23, 2022 18:51
Secure public key only openssh daemon configuration.
# Restrict SSH usage
AllowGroups ssh
AuthorizedKeysFile .ssh/authorized_keys
# Ciphers
RekeyLimit 512M 1H
KexAlgorithms [email protected]
Ciphers [email protected],[email protected]
MACs [email protected]
HostKeyAlgorithms ssh-ed25519
@Job79
Job79 / nft.conf
Created January 23, 2022 18:54
Example netfilter firewall configuration with whitelist for sshd
flush ruleset
table inet filter {
set open_tcp {
type inet_service;
elements = {
80, 443 # http
}
}