This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -x | |
| NS="ns1" | |
| VETH="veth1" | |
| VPEER="vpeer1" | |
| VETH_ADDR="10.200.1.1" | |
| VPEER_ADDR="10.200.1.2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TARGET_EXEC ?= a.out | |
| BUILD_DIR ?= ./build | |
| SRC_DIRS ?= ./src | |
| SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *.s) | |
| OBJS := $(SRCS:%=$(BUILD_DIR)/%.o) | |
| DEPS := $(OBJS:.o=.d) | |
| INC_DIRS := $(shell find $(SRC_DIRS) -type d) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def _parse_boot_device_list(boot_device_list): | |
| """ | |
| Returns boot devices order specified by current_assigned_sequence field | |
| (a list with names of the devices) | |
| """ | |
| boot_order = [] | |
| for _, devices in boot_device_list.items(): | |
| for boot_device in devices: | |
| id_parts = boot_device.id.split("#") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo iptables -t nat -D OUTPUT -p tcp -m owner ! --uid-owner root --dport 443 -j REDIRECT --to-port 8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| This document describes about installation and configuration of IPMI simulator. | |
| We need: qemu-kvm, OpenIPMI, OpenIPMI-tools | |
| 1) Install the qemu-kvm. We need the qemu, which have the IPMI pacthes. | |
| Use the source https://github.com/cminyard/qemu/tree/stable-2.2-ipmi | |
| ./configure, make and make install | |
| 2) Download the OpenIPMI libraries, from http://sourceforge.net/projects/openipmi/ | |
| Follow the process documented in lanserv/README.vm | |
| ./configure --prefix=/opt/openipmi/usr --sysconfdir=/opt/openipmi/etc \ | |
| --with-perlinstall=/opt/openipmi/usr/lib/perl \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| aptitude -y install expect | |
| // Not required in actual script | |
| MYSQL_ROOT_PASSWORD=abcd1234 | |
| SECURE_MYSQL=$(expect -c " | |
| set timeout 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Source: https://m.reddit.com/r/netsec/comments/4fi3hn/detecting_the_use_of_curl_bash_server_side/ | |
| $ cat > evil.sh <<EOF | |
| echo rm -rf /home; FOO=^M echo "nothing fishy here!" | |
| EOF | |
| $ cat evil.sh | |
| echo "nothing fishy here!" | |
| $ source evil.sh | |
| rm -rf /home | |
| nothing fishy here! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| URL website = new URL(FILE_URL); | |
| ReadableByteChannel rbc = Channels.newChannel(website.openStream()); | |
| FileOutputStream fos = new FileOutputStream(TMP_FILE_NAME); | |
| fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Fix: | |
| # E: This installation run will require temporarily removing the essential package sysvinit-utils:amd64 due to a Conflicts/Pre-Depends loop. This is often bad, but if you really want to do it, activate the APT::Force-LoopBreak option. | |
| apt-get update && apt-get dist-upgrade -o APT::Force-LoopBreak=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <random> | |
| int main(int argc, char *argv[]) { | |
| #ifdef APPROACH1 // C++11 | |
| std::random_device rd; // used once to initialise (seed) engine | |
| // random-number engine (Mersenne-Twister in this case) | |
| std::mt19937 rng(rd()); | |
| std::uniform_int_distribution<int> uni(min, max); // guaranteed unbiased |