This file contains 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 python | |
# -*- coding: utf-8 -*- | |
""" | |
JSON server, which serves local directory static files according to file's basename. | |
echo '{"key": "valuy"}' > resp.json | |
python -m JsonServer | |
curl http://localhost:8000/resp | |
""" |
This file contains 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/bash | |
# Create an environment variable for the correct distribution | |
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" | |
# Add the Cloud SDK distribution URI as a package source | |
echo "deb https://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list | |
# Import the Google Cloud Platform public key | |
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - |
This file contains 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 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 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 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 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 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 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 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); |