Skip to content

Instantly share code, notes, and snippets.

def download_photo(obc, local):
data = system.obc.read_file(obc)
with open(local, 'wb') as f:
f.write(data)
result = []
rem = data[4:]
import serial
import threading
import time
import gc
for i in xrange(0, 100):
print i
port = serial.Serial(port='\\\\.\\COM8', baudrate = 250000, rtscts = True, writeTimeout=None)
public class NCalcVerifyNames : LogicalExpressionVisitor
{
private readonly ITestOutputHelper _output;
public NCalcVerifyNames(ITestOutputHelper output)
{
_output = output;
}
public override void Visit(LogicalExpression expression)
@Novakov
Novakov / command.fs
Last active April 3, 2016 19:50
[Blog] Obsługa wiersza polecenia
module Pather.Commands.Run
[<Verb("run", HelpText = "Run process with given path set")>]
type Args = {
[<Option('f', "file", Required = true, HelpText = "Input file")>]File: string;
[<Option('g', "group", Default = "default", HelpText = "Name of group to use")>]Group: string;
[<Option('m', "mode", Default = PathSet.MergeKind.Append, HelpText = "Pathset merge mode")>]Mode: PathSet.MergeKind;
[<Value(0, HelpText = "Command to run", Required = true)>]Command: string;
[<Value(1, HelpText = "Command args")>]Args: string seq
}
@Novakov
Novakov / add_injections.xml
Last active March 31, 2016 07:02
[Blog] Pakowanie aplikacji z ILRepack
<Target Name="_AddInjections">
<ItemGroup>
<Injections Include="Injection.x86">
<Arch>x86</Arch>
</Injections>
<Injections Include="Injection.x64">
<Arch>x64</Arch>
</Injections>
</ItemGroup>
<ItemGroup>
@Novakov
Novakov / Pather\paket.references
Last active March 23, 2016 20:53
[Blog] Paket i Fake
System.Collections.Immutable
CommandLineParser
PeNet
Antlr4.Runtime
@Novakov
Novakov / findFunction.fs
Created March 20, 2016 20:29
[Blog]O szukaniu funkcji w procesie
let findFunction (processHandle: IntPtr) (library: string) (name: string) =
let library = ToolHelp.createSnapshot(ToolHelp.SnapshotFlags.Module ||| ToolHelp.SnapshotFlags.Module32) (GetProcessId(processHandle))
|> ToolHelp.modules
|> Seq.find (fun m -> m.ModuleName.Equals(library, StringComparison.InvariantCultureIgnoreCase))
let peFile = PeFile(library.ModulePath)
let func = peFile.ExportedFunctions |> Seq.find (fun f -> f.Name.Equals(name))
library.BaseAddress + (nativeint func.Address)
@Novakov
Novakov / DllImports.fs
Last active March 14, 2016 21:22
[Blog] Wstrzykiwanie biblioteki DLL do procesu
[<DllImport("kernel32.dll", SetLastError = true)>]
extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, IntPtr lpBuffer, int nSize, int * lpNumberOfBytesWritten);
[<DllImport("kernel32.dll", SetLastError = true)>]
extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, IntPtr dwSize, AllocationType flAllocationType, MemoryProtection flProtect);
[<DllImport("kernel32.dll")>]
extern IntPtr CreateRemoteThread(IntPtr hProcess, IntPtr lpThreadAttributes, UInt32 dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, UInt32 dwCreationFlags, IntPtr * lpThreadId);
[<DllImport("kernel32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)>]
@Novakov
Novakov / EnvInjectionHelper.fs
Last active March 11, 2016 21:17
[Blog] Ustawianie zmiennych srodowiskowych - implementacja
open System
let rec loop () =
let c = char (Console.Read())
let response = match c with
| 'E' -> "echo"
| 'S' ->
let varName = Console.ReadLine()
let varValue = Console.ReadLine()
package test;
import java.io.IOException;
import org.kohsuke.github.GHCommitState;
import org.kohsuke.github.GHRepository;
import org.kohsuke.github.GitHub;
public class Program {