Skip to content

Instantly share code, notes, and snippets.

from operator import or_
from functools import reduce
import inquirer
types = {'web': {'directory brute force', 'httrack', 'drupal scans', 'web app'},
'ssl': {'ssl audit', 'web app', 'drupal scans'},
'infra': {'nmap common', 'nmap all tcp', 'udp', 'windows audit'}}
def assessments(answers):
module Hello where
data JodaYears = native org.joda.time.Years where
pure native years org.joda.time.Years.years :: Int -> JodaYears
pure native getYears :: JodaYears -> Int
main _ = println $ JodaYears.getYears $ JodaYears.years 5
#! /usr/bin/env python3
import os
from sys import exit
from subprocess import call
from shlex import split
allowed_commands = 'ls echo cp mv rm ln whoami sort pwd cd gzip zcat zless ps free df du kill cat mkdir passwd uname whereis locate tail date'.split()
cmd = []
{-# LANGUAGE OverloadedStrings #-}
import Prelude hiding (putStrLn, writeFile)
import System.Environment (getArgs)
import Data.Word (Word16)
import Data.Maybe (fromMaybe)
import Data.Monoid ((<>), mempty)
import Data.ByteString (ByteString, writeFile)
import Data.ByteString.Char8 (putStrLn)
import Text.Regex.TDFA (match, makeRegexOpts, blankCompOpt)
@berdario
berdario / gist:9e2eecba0d35f9255f29
Last active August 29, 2015 14:18
libpcap1.5.3 regression
dario@curie ~/nixpkgs (pcapbug)>
/nix/store/s29l8m50xv0qxwvchvzf4znqs2z2dzcz-nmap-6.47/bin/nmap --version
Nmap version 6.47 ( http://nmap.org )
Platform: x86_64-unknown-linux-gnu
Compiled with: nmap-liblua-5.2.3 openssl-1.0.1l nmap-libpcre-7.6 libpcap-1.4.0 nmap-libdnet-1.12 ipv6
Compiled without:
Available nsock engines: epoll poll select
dario@curie ~/nixpkgs (pcapbug)>
sudo /nix/store/s29l8m50xv0qxwvchvzf4znqs2z2dzcz-nmap-6.47/bin/nmap -sS -vv 10.129.121.20 -n
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: java.lang.UnsatisfiedLinkError: /usr/lib/jayatana/libjayatanaag.so: libX11.so.6: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
This file has been truncated, but you can view the full file.
execve("/home/dario/.nix-profile/bin/java", ["java", "-jar", "/home/dario/Downloads/burpsuite_"...], [/* 75 vars */]) = 0
brk(0) = 0x10b8000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f19e5550000
readlink("/proc/self/exe", "/nix/store/nmd034pr2aa1brz015gix"..., 4096) = 80
access("/etc/ld-nix.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/nix/store/nmd034pr2aa1brz015gixp0zni9r2w7f-openjdk-8u40b25/lib/openjdk/bin/../lib/amd64/jli/tls/x86_64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/nix/store/nmd034pr2aa1brz015gixp0zni9r2w7f-openjdk-8u40b25/lib/openjdk/bin/../lib/amd64/jli/tls/x86_64", 0x7ffe5c7c7390) = -1 ENOENT (No such file or directory)
open("/nix/store/nmd034pr2aa1brz015gixp0zni9r2w7f-openjdk-8u40b25/lib/openjdk/bin/../lib/amd64/jli/tls/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/nix/store/nmd034pr2aa1brz015gixp0zni9r2w7f-openjdk-8u40b25/
execve("/home/dario/.nix-profile/bin/java", ["java", "-jar", "/home/dario/Downloads/burpsuite_"...], [/* 74 vars */]) = 0
brk(0) = 0x1c09000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f53fc6f9000
readlink("/proc/self/exe", "/nix/store/nmd034pr2aa1brz015gix"..., 4096) = 80
access("/etc/ld-nix.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/nix/store/nmd034pr2aa1brz015gixp0zni9r2w7f-openjdk-8u40b25/lib/openjdk/bin/../lib/amd64/jli/tls/x86_64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/nix/store/nmd034pr2aa1brz015gixp0zni9r2w7f-openjdk-8u40b25/lib/openjdk/bin/../lib/amd64/jli/tls/x86_64", 0x7ffece51e4f0) = -1 ENOENT (No such file or directory)
open("/nix/store/nmd034pr2aa1brz015gixp0zni9r2w7f-openjdk-8u40b25/lib/openjdk/bin/../lib/amd64/jli/tls/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/nix/store/nmd034pr2aa1brz015gixp0zni9r2w7f-openjdk-8u40b25/
# I use this both inside configuration.nix with
## environment.systemPackages = (import ((builtins.getEnv "PWD") + "/packages.nix" ));
# and on the command line with
## nix-env -I ~ -f packages.nix -iA
#with (import (builtins.getEnv "HOME" + "/.nix-defexpr/channels_root/nixos/default.nix") {}).pkgs;
with (import "/home/dario/.nix-defexpr/channels_root/nixos/default.nix" {}).pkgs;
[
# software available in the nixos nix-channel
] ++
package object wordwrap{
def wrapSingleLine(column: Int)(words: List[String]): Iterable[String] = words match {
case List() => List();
case (hd :: tl) => {
tl.scanLeft(hd)({_ + " " + _}).span({_.length <= column}) match {
case (List(), _) => hd.grouped(column).toIterable ++ wrapSingleLine(column)(tl)
case (f, s) => {
val f2 = f.map({_.split(" ").last})
f2 ++ wrapSingleLine(column)(s.map{_.drop(f2.last.length)});
}