Skip to content

Instantly share code, notes, and snippets.

@Joeviocoe
Joeviocoe / qvm-portfwd-socat
Last active January 3, 2024 22:44
Qubes-OS socket connection to allow external connections
NetVM=$1
TargetVM=$2
Service=$3
TCP_Port=$4
wasrunning=$(qvm-ls | grep $TargetVM | grep -i RUNNING)
echo -ne "TCP socket connection for $Service from $NetVM to $TargetVM on port $TCP_Port...\nPress Any Key to End\n\n"
trap cleanup 1 2 3 6 15
cleanup() {
# qvm-run -p -u root $NetVM "iptables-save | grep -v 'SOCAT_PortFwd-$Service' | iptables-restore"
@Joeviocoe
Joeviocoe / qvm-portfwd-iptables
Last active June 16, 2021 11:40 — forked from daktak/qvm-exposeip.sh
Qubes-os port forwarding to allow external connections
#!/bin/sh
# Inspired by https://gist.github.com/daktak/f887352d564b54f9e529404cc0eb60d5
# Inspired by https://gist.github.com/jpouellet/d8cd0eb8589a5b9bf0c53a28fc530369
ip() { qvm-prefs -g -- "$1" ip; }
netvm() { qvm-prefs -g -- "$1" netvm; }
forward() {
local from_domain=$1
local to_domain=$2
@kckrinke
kckrinke / qvm-expose-port
Last active June 14, 2018 03:50
Expose a Qubes AppVM port to the public networks.
#!/usr/bin/env perl
use strict;
use warnings;
use Pod::Usage;
use IPC::Open3;
use Getopt::Long;
use File::Basename;
use constant { True => 1, False => 0 };
use Symbol 'gensym';
$|=1; #unbuffered
@bulljit
bulljit / removecompletedtorrents.sh
Created January 22, 2011 23:17
Transmission-Daemon: Remove Completed Torrents
#!/bin/sh
# script to check for complete torrents in transmission folder, then stop and move them
# either hard-code the MOVEDIR variable here…
MOVEDIR=/home/mjdescy/media # the folder to move completed downloads to
# …or set MOVEDIR using the first command-line argument
# MOVEDIR=%1
# use transmission-remote to get torrent list from transmission-remote list
# use sed to delete first / last line of output, and remove leading spaces
# use cut to get first field from each line