Skip to content

Instantly share code, notes, and snippets.

@timsonner
timsonner / calculator.cpp
Created March 6, 2023 20:57
C++. Calculator. Usage of namespace and switch statements.
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
// Define a top-level namespace for the calculator
namespace calculator {
// Define a nested namespace for the functions
namespace functions {
@timsonner
timsonner / decimal-converter.cpp
Last active March 7, 2023 23:30
C++. See binary, hex, octal, and decimal representations of a number.
// Include headers for classes...
#include <iostream>
#include <iomanip>
#include <string>
#include <bitset>
// Classes from different namespaces...
using std::cout;
using std::cin;
using std::endl;
@timsonner
timsonner / Terminal.cs
Last active April 4, 2023 11:21
C#. Unity. System.Diagnostics library. Spawn system processes, TMP_InputField and TMP_Text. Mock Terminal.
using System.Diagnostics;
using System.IO;
using System.Threading;
using TMPro;
using UnityEngine;
public class Terminal : MonoBehaviour
{
public TMP_InputField inputField;
public TMP_Text outputText;
@timsonner
timsonner / random-circles.bas
Last active April 4, 2023 14:24
QBasic. Draw random circle at random coordinate with random radius and fill color.
SCREEN 12 ' Set screen mode to 640x480, 32-bit color
DO ' Infinite loop
RANDOMIZE TIMER ' initialize the random number generator
' Generate random circle properties
x = INT(RND * 641) ' Random x-coordinate 0 to 640
y = INT(RND * 481) ' Random y-coordinate 0 to 480
r = INT(RND * 101) ' Random radius 0 to 100
@timsonner
timsonner / check-hash.go
Created May 28, 2023 17:29
GoLang. Checks the hash of a file against an expected hash.
package main
import (
"crypto/md5"
"crypto/sha256"
"encoding/hex"
"flag"
"fmt"
"hash"
"io"
@timsonner
timsonner / scan-for-web-servers.go
Created June 3, 2023 00:24
GoLang. Scans a range of IPs for web servers running on ports 80, 8080, and 443.
package main
import (
"fmt"
"net"
"sync"
)
func main() {
var wg sync.WaitGroup
@timsonner
timsonner / test-domain-creds.go
Last active June 4, 2023 19:02
GoLang. Tests a users credentials against a M$ domain. Pre-cursor to a password spraying script. Run this in Windows.
package main
import (
"fmt"
"syscall"
"unsafe"
)
const (
LOGON32_LOGON_NETWORK = 3
@timsonner
timsonner / format-users.bat
Last active June 5, 2023 01:50
Batch. Run “net user /domain > users.txt”. Remove the first 6 lines of users.txt, then the last line and finally run this script. Drop it into pass-spray.go.
@echo off
if "%~1" == "" (
echo Usage: %0 users.txt
exit /b 1
)
for /f "usebackq tokens=1,2,3*" %%A in (%1) do (
echo %%A
echo %%B
@timsonner
timsonner / pass-spray.go
Last active June 6, 2023 11:46
GoLang. Domain password spray script. Runs on Windows.
package main
import (
"fmt"
"io/ioutil"
"strings"
"syscall"
"unicode/utf16"
"unsafe"
@timsonner
timsonner / unsafe-pe-usage.go
Last active June 11, 2023 08:54
GoLang. Messing with PE injection.
package main
import (
"encoding/binary"
"log"
"os"
"reflect"
"unsafe"
)