diff options
author | makefu <github@syntax-fehler.de> | 2011-08-24 01:59:20 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2011-08-24 01:59:20 +0200 |
commit | d3d0b0fe07fbd4dd2285796bd94ad5afdd494c7c (patch) | |
tree | 2724d5cd14d7c6d2bf925c7d451e80d84d12c4ae | |
parent | 1288c00ac6048b180e959b56d1834f927417c552 (diff) | |
parent | df80b8badf01f971111ea3099e77862320fa5736 (diff) |
Merge branch 'master' of github.com:krebscode/painload
33 files changed, 21558 insertions, 36 deletions
@@ -3,3 +3,5 @@ a.out /bin/ /node/src /node/out +/ovh/soapi/src +/ovh/soapi/SOAPpy diff --git a/btc/mtgox/json_ticker_helper.py b/btc/mtgox/json_ticker_helper.py new file mode 100755 index 00000000..727dd594 --- /dev/null +++ b/btc/mtgox/json_ticker_helper.py @@ -0,0 +1,7 @@ +#!/usr/bin/python + +import json,sys + +result = json.load(sys.stdin) + +print "High: " + str(result["ticker"]["high"]) + " Low: " + str(result["ticker"]["low"]) + " Last: " + str(result["ticker"]["last"]) diff --git a/btc/mtgox/ticker_text.sh b/btc/mtgox/ticker_text.sh new file mode 100755 index 00000000..2bcac134 --- /dev/null +++ b/btc/mtgox/ticker_text.sh @@ -0,0 +1,3 @@ +#!/bin/sh +dirname=`dirname $(readlink -f $0)` +$dirname/mtgox.ticker | python $dirname/json_ticker_helper.py diff --git a/cholerab/bling/krebs-v2_320x240.png b/cholerab/bling/krebs-v2_320x240.png Binary files differnew file mode 100644 index 00000000..cae1e835 --- /dev/null +++ b/cholerab/bling/krebs-v2_320x240.png diff --git a/cholerab/bling/krebs_inverse_r0ket.gif b/cholerab/bling/krebs_inverse_r0ket.gif Binary files differnew file mode 100644 index 00000000..58c753e7 --- /dev/null +++ b/cholerab/bling/krebs_inverse_r0ket.gif diff --git a/cholerab/bling/krebs_plain_r0ket.gif b/cholerab/bling/krebs_plain_r0ket.gif Binary files differnew file mode 100644 index 00000000..d246d0c7 --- /dev/null +++ b/cholerab/bling/krebs_plain_r0ket.gif diff --git a/cholerab/kasten/doku b/cholerab/kasten/doku new file mode 100644 index 00000000..8246c80f --- /dev/null +++ b/cholerab/kasten/doku @@ -0,0 +1,7 @@ +[23:08:57] makefu> tv\d: wir haben ein neuen status in krebs. die Cancer Knights. Sie arbeiten fuer uns und fuehlen sich besser weil sie ueber den crab people sind. Sie stellen hardware und + arbeitskraft bereit, haben aber keine rechte +[23:09:49] momorient> die cancer knights punchen dann auch für uns wenn wir zu faul sind oder? +[23:10:22] makefu> infin wird der erste cancer knight +[23:11:46] makefu> jo, solange das noch nicht implementiert ist haben wir cancer knights +[23:12:26] makefu> sobald 3 cancer knights zusammen sind koennen sie krebsminister werden und dann zum punchen aufgefordert werden + diff --git a/cholerab/shirts/bestellliste b/cholerab/shirts/bestellliste index d097ff7d..9a42b443 100644 --- a/cholerab/shirts/bestellliste +++ b/cholerab/shirts/bestellliste @@ -1,16 +1,17 @@ -tv: 2 M - 1 S + GEZ ERH +tv: 2 M j + 1 S j ulrich: 1 M -felix: 2 M - 1 S -Lassulus: 2 M +felix: 2 M j j + 1 S j j +Lassulus: 2 M j j Pfleidi: 1 L Tensai: 1 L Momo: 1 XXL -hadez: 1 L - 1 M +hadez: 1 L j j + 1 M j j Phil: 1 S -Lukas: 1 M +Lukas: 1 M v j Jan: 1 2XL Ronny: 1 M Marc: 1 L @@ -18,6 +19,6 @@ Lotho: 1 XL Sascha: 1 XL Moritz: 1 M RIPE: 1 XL -kh: 1 L -miefda: 1 L - 1 XL +kh: 1 L j j +miefda: 1 L j j + 1 XL j j diff --git a/claws/.gitignore b/claws/.gitignore new file mode 100644 index 00000000..5da5924f --- /dev/null +++ b/claws/.gitignore @@ -0,0 +1 @@ +rcontrol diff --git a/claws/Makefile b/claws/Makefile new file mode 100644 index 00000000..abfae5eb --- /dev/null +++ b/claws/Makefile @@ -0,0 +1,18 @@ +# Makefile for the rcontrol program +# We set a setuid bit as this tools needs root privilleges to open the FT232 device. + +BINARY=./rcontrol + +install: all + ln -snf $$PWD/$(BINARY) ../bin/ + +all:$(BINARY) + chown root.root $(BINARY) + chmod +s $(BINARY) + +$(BINARY): rcontrol.c + #punani install libftdi1 libftdi-dev + gcc -Wall -lusb -lftdi rcontrol.c -o $(BINARY) + +clean: + rm -f $(BINARY) diff --git a/claws/communication.h b/claws/communication.h new file mode 100644 index 00000000..db4b2c36 --- /dev/null +++ b/claws/communication.h @@ -0,0 +1,25 @@ +/* These are the command codes of the relay card. If you change something here you must + * recompile the firmware and the control tool. */ +#ifndef _COMMUNICATION_H +#define _COMMUNICATION_H + +#define COMMAND_RELAY_ON 0x01 +#define COMMAND_RELAY_OFF 0x02 +#define COMMAND_RELAY_TOGGLE 0x04 +#define COMMAND_RELAY_SET 0x08 +#define COMMAND_RELAY_TIME_ON 0x10 +#define COMMAND_RELAY_TIME_OFF 0x20 +#define COMMAND_RELAY_TIME_CYCLIC 0x40 +#define COMMAND_GET_STATUS 0x80 +#define COMMAND_DEL_TIMERS 0x81 +#define COMMAND_SETUP_REMOTE 0x82 + + +#define RESPONSE_OK 0xff +#define RESPONSE_INVALID_COMMAND 0xfe +#define RESPONSE_INVALID_ARGUMENT 0xfd +#define RESPONSE_TRANSMISSION_ERROR 0xfc + +#define COMMANDO_LENGTH 4 + +#endif diff --git a/claws/rcontrol.c b/claws/rcontrol.c new file mode 100644 index 00000000..972c97d0 --- /dev/null +++ b/claws/rcontrol.c @@ -0,0 +1,479 @@ +/* +----------------------------------------------------------------------+ + * | relay control program | + * | by mgr, 2007 | + * | last change: 2009-01-05 | + * | | + * | This program is used to control the relay card version 1.0. For more | + * | information have a look at the project homepage. | + * | You will need libftdi in order to compile this tool. | + * | | + * | NOTE: For some reason the -l option causes a program crash if I | + * | compile this program with -O2. On top of that this code seems to | + * | be quite optimal, the program size gets a little larger with -O2, | + * | so I suggest you just compile it without optimization. | + * +----------------------------------------------------------------------+ + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <getopt.h> +#include <ctype.h> +#include <time.h> +#include <ftdi.h> // libftdi + +/* Notice that if you experiment with the baud rate, you will have to adapt + * the firmware, too. Also I do not recommend it, as 9600 Bauds are completely + * sufficient for this application. */ +#define BAUD 9600 + +/* If you are using more than one FT232-based pieces of hardware at once, + * we need a way to uniquely address any given one. This is done by the + * serial of the specific device which you can pass to this tool or specify + * here. If no serial is specified (NULL), the first found device is opened. */ +#define DEFAULT_FT_SERIAL "A6TMRSS6" + +#define VERSION "1.0" + +#define OPTION_ADDRESS 0x01 +#define OPTION_INTERVAL 0x04 +#define OPTION_CYCLIC 0x08 +#define OPTION_ON 0x10 +#define OPTION_OFF 0x20 +#define OPTION_TOGGLE 0x40 +#define OPTION_DEL_TIMERS 0x80 +#define OPTION_LIST_DEVICES 0x200 + +#define EXIT_CODE_OK 0 +#define EXIT_CODE_FAILURE 1 + +#include "communication.h" + +/* function prototypes */ +void usage(char* name); +void version(void); +const char* card_strerror(int error); +int valid_argument(const char* str); +void exit_gracefully(struct ftdi_context* ftdic, char exit_code); + + +int main(int argc, char **argv) +{ + int ret=0, int_argument=0, option_flags=0, long_index=0, i=0, num_ops=0; + char c=0; + unsigned char buf[COMMANDO_LENGTH], char_argument=0, operation=0; + const char* ft_serial=DEFAULT_FT_SERIAL; + double double_argument; + char buf0[64], buf1[64], buf2[64]; + time_t start_time; + + //struct ftdi_eeprom eeprom; + + struct ftdi_context ftdic; + struct ftdi_device_list *devlist=NULL, *curdev=NULL; + + static struct option long_options[] = + { + {"help", 0, 0, '?'}, + {"version", 0, 0, 'V'}, + {"on", 1, 0, 'o'}, + {"off", 1, 0, 'f'}, + {"toggle", 1, 0, 't'}, + {"set", 1, 0, 's'}, + {"status", 0, 0, 'S'}, + {"interval", 1, 0, 'v'}, + {"cyclic", 0, 0, 'c'}, + {"address", 1, 0, 'a'}, + {"delete-timers", 0, 0, 'd'}, + {"list-devices", 0, 0, 'l'}, + {0, 0, 0, 0 } + }; + + /* fetch the command line options */ + while ((c = getopt_long_only(argc, argv, "?Vo:f:t:s:Sv:ca:dl", long_options, + &long_index)) != -1) + { + switch (c) + { + case 'o': case 'f': case 't': + int_argument = atoi(optarg); + + if (int_argument > 6 || int_argument < 1 || !valid_argument(optarg)) + { + fprintf(stderr, "%s: -s: invalid value `%s' (1-6 is valid)\n", + *argv, optarg); + return EXIT_CODE_FAILURE; + } + + char_argument = (unsigned char)int_argument; + + if (c == 't') + { + operation = COMMAND_RELAY_TOGGLE; + option_flags |= OPTION_TOGGLE; + } else if (c == 'o') + { + operation = COMMAND_RELAY_ON; + option_flags |= OPTION_ON; + } else + { + operation = COMMAND_RELAY_OFF; + option_flags |= OPTION_OFF; + } + + num_ops++; + + break; + + case 's': + int_argument = atoi(optarg); + + if (int_argument > (1 << 6)-1 || int_argument < 0 || !valid_argument(optarg)) + { + fprintf(stderr, "%s: -s: invalid value `%s'\n", *argv, optarg); + return EXIT_CODE_FAILURE; + } + + char_argument = (unsigned char)int_argument; + operation = COMMAND_RELAY_SET; + num_ops++; + break; + + case 'S': + operation = COMMAND_GET_STATUS; + num_ops++; + break; + + case 'v': + double_argument = atof(optarg); + int_argument = (int)(double_argument*60) /10; + + if (int_argument < 1 || int_argument > (1 << 16)-1) + { + fprintf(stderr, "%s: -i: invalid interval `%s'\n", *argv, optarg); + return EXIT_CODE_FAILURE; + } + + option_flags |= OPTION_INTERVAL; + break; + + case 'c': + option_flags |= OPTION_CYCLIC; + break; + + case 'd': + operation = COMMAND_DEL_TIMERS; + option_flags |= OPTION_DEL_TIMERS; + num_ops++; + break; + + case 'a': + if (strlen(optarg) != 8) + { + fprintf(stderr, "%s: -s: invalid serial number `%s'\n", *argv, optarg); + return EXIT_CODE_FAILURE; + } + + ft_serial = optarg; + option_flags |= OPTION_ADDRESS; + break; + + case 'l': + option_flags |= OPTION_LIST_DEVICES; + break; + + case 'V': + version(); + break; + case '?': default: + usage(*argv); + break; + } + } + + /* check whether the command line options are valid */ + if ((option_flags & OPTION_INTERVAL)) + { + if (option_flags & OPTION_DEL_TIMERS) + { + fprintf(stderr, "%s: -d cannot be mixed with timing options\n", *argv); + usage(*argv); + } + + if (option_flags & OPTION_CYCLIC) + { + operation = COMMAND_RELAY_TIME_CYCLIC; + } else if (option_flags & OPTION_ON) + { + operation = COMMAND_RELAY_TIME_ON; + } else if (option_flags & OPTION_OFF) + { + operation = COMMAND_RELAY_TIME_OFF; + } else + { + fprintf(stderr, "%s: -v: you must also specify an operation (-o or -f)\n", *argv); + usage(*argv); + } + } + + if (!operation && !(option_flags & OPTION_LIST_DEVICES)) + { + usage(*argv); + } + + if (((option_flags & OPTION_DEL_TIMERS) && (operation != COMMAND_DEL_TIMERS))) + { + fprintf(stderr, "%s: invalid mixture of options\n", *argv); + usage(*argv); + } + + if (num_ops > 1) + { + fprintf(stderr, "%s: more than one operation specified\n", *argv); + usage(*argv); + } + + if (ftdi_init(&ftdic) < 0) + { + fprintf(stderr, "%s: unable to initialize FTDI context: %d (%s)\n", *argv, ret, + ftdi_get_error_string(&ftdic)); + return EXIT_CODE_FAILURE; + } + + /* list all found FT232 devices */ + if (option_flags & OPTION_LIST_DEVICES) + { + printf("scanning for FT232 devices...\n" + "you can address the devices using `%s -a <serial>'\n", *argv); + + if ((ret = ftdi_usb_find_all(&ftdic, &devlist, 0x0403, 0x6001)) < 0) + { + fprintf(stderr, "%s: unable to scan devices: %d (%s)\n", *argv, ret, + ftdi_get_error_string(&ftdic)); + exit(EXIT_CODE_FAILURE); + } + + if (ret == 0) + { + printf(" no devices found :(\n"); + return EXIT_CODE_OK; + } + + for (i=0, curdev = devlist; curdev != NULL; i++) + { + if (ftdi_usb_get_strings(&ftdic, curdev->dev, buf0, sizeof(buf0)/sizeof(char), + buf1, sizeof(buf1)/sizeof(char), buf2, sizeof(buf2)/sizeof(char)) < 0) + { + fprintf(stderr, "unable to fetch information for device #%i: %s\n", i, + ftdi_get_error_string(&ftdic)); + // continue caused an endless loop in case of an error + break; + } + + printf("\ndevice #%i%s:\n" + " manufacturer: %s\n" + " device: %s\n" + " serial: %s\n", i, (i == 0 ? " (default)" : ""), + (buf0 != NULL ? buf0 : "n/a"), (buf1 != NULL ? buf1 : "n/a"), + (buf2 != NULL ? buf2 : "n/a")); + + curdev = curdev->next; + } + + ftdi_list_free(&devlist); + return EXIT_CODE_OK; + } + + /* Try to open the specified device. If that fails, we take a long shot + * and open the first found FT232 device and assume its the relay card. + * We don't do this if an address was specified with the -a option. */ + if ((ret = ftdi_usb_open_desc(&ftdic, 0x0403, 0x6001, NULL, ft_serial)) < 0) + { + fprintf(stderr, "%s: unable to open ftdi device: %d (%s)\n", *argv, ret, + ftdi_get_error_string(&ftdic)); + exit(EXIT_CODE_FAILURE); + } + + /* get rid of any data still floating around the buffer */ + ftdi_usb_reset(&ftdic); + ftdi_usb_purge_buffers(&ftdic); + + + if ((ret = ftdi_set_baudrate(&ftdic, BAUD)) < 0) + { + fprintf(stderr, "%s: unable to set baudrate: %d (%s)\n", *argv, ret, + ftdi_get_error_string(&ftdic)); + exit_gracefully(&ftdic, EXIT_CODE_FAILURE); + } + + if ((ret = ftdi_set_line_property(&ftdic, 8, 2, NONE)) < 0) + { + fprintf(stderr, "%s: unable to set line property: %d (%s)\n", *argv, ret, + ftdi_get_error_string(&ftdic)); + exit_gracefully(&ftdic, EXIT_CODE_FAILURE); + } + + if ((ret = ftdi_setflowctrl(&ftdic, SIO_RTS_CTS_HS)) < 0) { + fprintf(stderr, "%s: unable to setup flow control: %d (%s)\n", *argv, ret, + ftdi_get_error_string(&ftdic)); + exit_gracefully(&ftdic, EXIT_CODE_FAILURE); + } + + /*if ((ret = ftdi_set_latency_timer(&ftdic, 10)) < 0) + { + fprintf(stderr, "%s: unable to set latency timer: %d (%s)\n", *argv, ret, + ftdi_get_error_string(&ftdic)); + exit_gracefully(&ftdic, EXIT_CODE_FAILURE); + }*/ + + buf[0] = operation; + buf[2] = 0; buf[3] = 0; buf[4] = 0; + + switch (operation) + { + case COMMAND_RELAY_SET: + buf[1] = char_argument; + break; + + case COMMAND_RELAY_ON: case COMMAND_RELAY_OFF: + case COMMAND_RELAY_TOGGLE: + buf[1] = (1 << (char_argument-1)); + break; + + case COMMAND_RELAY_TIME_ON: + case COMMAND_RELAY_TIME_OFF: + case COMMAND_RELAY_TIME_CYCLIC: + buf[1] = char_argument-1; + buf[2] = (int_argument & 0xff); // low byte + buf[3] = (int_argument >> 8); // high byte + break; + + default: + break; + } + + /* These values might not make much sense are vital to the correct + * funtion of this program, so better don't touch them. */ + ftdi_write_data_set_chunksize(&ftdic, 1); + ftdi_read_data_set_chunksize(&ftdic, 4); + + /* send the command */ + if (ftdi_write_data(&ftdic, buf, COMMANDO_LENGTH) != COMMANDO_LENGTH) + { + fprintf(stderr, "%s: unable to send command: %s\n", *argv, + ftdi_get_error_string(&ftdic)); + exit_gracefully(&ftdic, EXIT_CODE_FAILURE); + } + + /* Read the card's response. */ + start_time = time(NULL); + while ((ret = ftdi_read_data(&ftdic, buf, 1)) == 0) { + usleep(500); + if (time(NULL)-start_time >= 2) { + fprintf(stderr, "%s: unable to read card response, the operation might have " + "failed\n", *argv); + exit_gracefully(&ftdic, EXIT_FAILURE); + } + } + + if (operation == COMMAND_GET_STATUS && buf[0] <= ((1 << 7)-1)) + { + printf("relay status: %i (0b%s%s%s%s%s%s)\n", buf[0], + (buf[0] & (1 << 5)) ? "1" : "0", + (buf[0] & (1 << 4)) ? "1" : "0", + (buf[0] & (1 << 3)) ? "1" : "0", + (buf[0] & (1 << 2)) ? "1" : "0", + (buf[0] & (1 << 1)) ? "1" : "0", + (buf[0] & (1 << 0)) ? "1" : "0"); + exit_gracefully(&ftdic, EXIT_CODE_OK); + } + + if (buf[0] != RESPONSE_OK) + { + fprintf(stderr, "%s: relay card returned: %s\n", *argv, card_strerror(buf[0])); + exit_gracefully(&ftdic, EXIT_FAILURE); + } + + /* we can exit now */ + exit_gracefully(&ftdic, EXIT_CODE_OK); + return 0; // to make the compiler happy +} + +void exit_gracefully(struct ftdi_context* ftdic, char exit_code) +{ + ftdi_usb_purge_buffers(ftdic); + ftdi_usb_close(ftdic); + ftdi_deinit(ftdic); + + exit(exit_code); +} + +int valid_argument(const char* str) +{ + int i; + + for (i=0; i<strlen(str); i++) + { + if (!isdigit(str[i]) && (str[i] != '.')) + return 0; + } + + return 1; +} + +const char* card_strerror(int error) +{ + const char* message = "no error"; + + switch (error) + { + case RESPONSE_OK: + message = "all fine"; + break; + case RESPONSE_INVALID_COMMAND: + message = "invalid command"; + break; + case RESPONSE_INVALID_ARGUMENT: + message = "invalid command argument"; + break; + case RESPONSE_TRANSMISSION_ERROR: + message = "transmission error"; + break; + } + + return message; +} + +void usage(char *name) +{ + printf("\nrelay control program usage ==================================================\n" + " -?/--help .............. dump this screen\n" + " -V/--version ........... echo some program information\n" + " -o/--on <num>: ......... switch relay <num> on\n" + " -f/--off <num>: ........ switch relay <num> off \n" + " -t/--toggle <num>: ..... toggle relay <num> \n" + " -s/--set <mask>: ....... set the status of all relays to <mask>\n" + " -S/--status: ........... get the current relay status\n" + " -v/--interval <units> .. specify a timing interval (in minutes)\n" + " -c/--cyclic: ........... makes a timing operation (-v) cyclic\n" + " -a/--address <serial> .. addresses a specific card if multiple are installed\n" + " -d/--delete-timers ..... deletes all active timers\n" + " -l/--list-devices ...... lists all found FT232 devices\n\n"); + exit(0); +} + +void version(void) +{ + printf("\nThis is the relay control program version %s ($Revision: 26 $)\n" + "----------------------------------------------------------------\n" + " written by Michael Gross, 2007\n" + " binary compiled: %s %s\n\n" + "This program can be redistributed under the terms of the GNU GPL version 2\n" + "or later. For more information about this software and the hardware, visit\n" + "my homepage at http://www.coremelt.net. As usual with free software, there\n" + "is ABSOLUTELY NO WARRANTY. For details, refer to the GPL.\n\n", VERSION, + __DATE__, __TIME__); + + exit(0); +} diff --git a/filebitch/README b/filebitch/README index 177bb374..5ae3a666 100644 --- a/filebitch/README +++ b/filebitch/README @@ -1,12 +1,14 @@ -The connec_sh script morses the IP + "connected" when a user connects to filebitchs proftpd server. +The connect_narf.pl script morses the IP + "connected" when a user connects to filebitchs proftpd server. +The disconnect_narf.pl scritp will do the obvious opposite. It will hopefully drive someone crazy. To make it run you need to add some lines to your proftpd config. I decided not to let Krebs do this as I didn't want to break your FTP Server (I know FTP is broken by default). The 5 necessary lines are: -ExtendedLog /var/log/proftpd/ftp_auth.log AUTH auth + <IfModule mod_exec.c> ExecEngine on - ExecOnConnect "/krebs/filebitch/connect_narf.pl" + ExecOnConnect "/krebs/filebitch/connect_narf.pl %a" + ExecOnExit "/krebs/filebitch/disconnect_narf.pl %a" </IfModule> diff --git a/filebitch/connect_narf.pl b/filebitch/connect_narf.pl index fd2742dc..8e984150 100755 --- a/filebitch/connect_narf.pl +++ b/filebitch/connect_narf.pl @@ -4,12 +4,15 @@ #and #<IfModule mod_exec.c> # ExecEngine on -# ExecOnConnect "/krebs/filebitch/connect_narf.pl" +# ExecOnConnect "/krebs/filebitch/connect_narf.pli %a" #</IfModule> -#$ip = system("tail -n 1 /var/log/proftpd/ftp_auth.log"); +$ip = $ARGV[0]; #I'm very sorry for this regex, but i only wanted it to get _real_ IPv4 Adresses of the log file, not any kind of timestamp bullshit -#$ip =~ s/\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b//g; +$ip =~ s/\b(25[0-5]|2[0-4][0-9]|[1]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[1]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[1]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[1]?[0-9][0-9]?)\b//g; #getting some guys sitting next to the Server pissed :) -my $ip = "USER"; -system("beep -l 42 -f 2000 -D 42 -n -l 42 -f 3337"); +system("morse -l 42 -f 2000 $ip"); +system("morse -l 42 -f 3000 \"connected\""); + +# Uncomment the beep below to play the enterprise connect sound +# system("beep -l 42 -f 2000 -D 42 -n -l 42 -f 3337"); diff --git a/filebitch/disconnect_narf.pl b/filebitch/disconnect_narf.pl index af7bea6c..77fbf743 100755 --- a/filebitch/disconnect_narf.pl +++ b/filebitch/disconnect_narf.pl @@ -1,15 +1,16 @@ #!/usr/bin/perl #Please add the following to your proftpd config file -#ExtendedLog /var/log/proftpd/ftp_auth.log AUTH auth -#and #<IfModule mod_exec.c> # ExecEngine on -# ExecOnExit "/krebs/filebitch/disconnect_narf.pl" +# ExecOnExit "/krebs/filebitch/connect_narf.pli %a" #</IfModule> -#$ip = system("tail -n 1 /var/log/proftpd/ftp_auth.log"); +$ip = $ARGV[0]; #I'm very sorry for this regex, but i only wanted it to get _real_ IPv4 Adresses of the log file, not any kind of timestamp bullshit -#$ip =~ s/\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b//g; +$ip =~ s/\b(25[0-5]|2[0-4][0-9]|[1]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[1]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[1]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[1]?[0-9][0-9]?)\b//g; #getting some guys sitting next to the Server pissed :) -my $ip = "USER"; -system("beep -l 42 -f 2000 -D 42 -n -l 42 -f 1000"); +system("morse -l 42 -f 2000 $ip"); +system("morse -l 42 -f 3000 \"disconnected\""); + +# Uncomment the beep below to play the enterprise connect sound +# system("beep -l 42 -f 2000 -D 42 -n -l 42 -f 3337"); diff --git a/kachelmann/Makefile b/kachelmann/Makefile index 7fa3ec2d..3343d941 100644 --- a/kachelmann/Makefile +++ b/kachelmann/Makefile @@ -1,8 +1,7 @@ .PHONY: infect -INSTALL_DIR = /root/bin/ -infect: - mkdir -p /tmp/kachelmann/ - cp conditions ${INSTALL_DIR} - mv ${INSTALL_DIR}conditions ${INSTALL_DIR}kachelmann - chmod +x ${INSTALL_DIR}kachelmann +install: + # punani -Ei w3m php php-xml-simple + ln -s $$PWD/conditions ../bin/conditions + ln -s $$PWD/wetter ../bin/wetter + ln -s ${INSTALL_DIR}conditions ${INSTALL_DIR}kachelmann diff --git a/kachelmann/changes b/kachelmann/changes index 1875dabd..22116967 100644..100755 --- a/kachelmann/changes +++ b/kachelmann/changes @@ -10,15 +10,15 @@ my $condition_store = undef; my $data_old = $condition_store; while (1) { &xml_update(); + $data_old = $data_new; $data_new = $condition_store; - if($data_new == $data_old){ - system("espeak Das Wetter hat sich von $data_old in $data_new verändert"); + if($data_new ne $data_old){ + system("espeak \"Das Wetter hat sich von $data_old in $data_new verändert\n\""); } sleep 300; - $data_new = $data_old; } sub xml_update(){ - $xml_store = system("w3m -dump \"http://www.google.com/ig/api?weather=70327-stuttgart&hl=de\""); + $xml_store = `w3m -dump "http://www.google.com/ig/api?weather=70327-stuttgart&hl=de"`; $xml_store = $xml->XMLin($xml_store); $condition_store = $xml_store->{weather}->{current_conditions}->{condition}->{data}; } diff --git a/kachelmann/wetter b/kachelmann/wetter new file mode 100755 index 00000000..957e13e2 --- /dev/null +++ b/kachelmann/wetter @@ -0,0 +1,6 @@ +#!/usr/bin/perl +use XML::Simple; +my $result = `w3m -dump "http://www.google.com/ig/api?weather=70327-stuttgart&hl=de"`; +my $xml = new XML::Simple; +my $data = $xml->XMLin($result); +print ("$data->{weather}->{current_conditions}->{condition}->{data} bei $data->{weather}->{current_conditions}->{temp_c}->{data} Grad Zelsius\n"); diff --git a/morse/Makefile b/morse/Makefile new file mode 100644 index 00000000..2afa845e --- /dev/null +++ b/morse/Makefile @@ -0,0 +1,3 @@ +.phony: all +all: + ln -fs $$PWD/morse.sh ../bin/morse diff --git a/oncology/Makefile b/oncology/Makefile new file mode 100644 index 00000000..258ee130 --- /dev/null +++ b/oncology/Makefile @@ -0,0 +1,22 @@ +build-deps: + #punani -Ei libtool automake autoconf zlib1g-dev libssl-dev python-dev libc6 libusb-dev libibus-dev subversion libgd2-noxpm-dev libgd2-noxpm lcd4linux + +/usr/bin/lcd4linux: build-deps + #punani -Ei lcd4linux + sed -i 's/usr\/sbin\/lcd4linux/usr\/bin\/lcd4linux/g' /etc/init.d/lcd4linux + dpfhack_display/build-dpf-lcd4linux.sh + make -C dpfhack_display/lcd4linux/ install + +lcd4linux_autostart: + # service lcd4linux start + # update-rc.d lcd4linux + +install: /usr/bin/lcd4linux /etc/lcd4linux.conf lcd4linux_autostart + # TODO this is debian only + +update: /etc/lcd4linux.conf + +/etc/lcd4linux.conf: lcd4linux.conf + chown krebs:krebs lcd4linux.conf + chmod 600 lcd4linux.conf + cp -a lcd4linux.conf /etc/lcd4linux.conf diff --git a/oncology/bin/krebshostup b/oncology/bin/krebshostup new file mode 100755 index 00000000..eb422ff7 --- /dev/null +++ b/oncology/bin/krebshostup @@ -0,0 +1,2 @@ +#!/bin/sh +nmap -sP 10.7.7.0/24 -T5| grep "Host is up" | wc -l diff --git a/oncology/lcd4linux.conf b/oncology/lcd4linux.conf new file mode 100644 index 00000000..34df9f65 --- /dev/null +++ b/oncology/lcd4linux.conf @@ -0,0 +1,572 @@ +Layout 'Krebs'
+Display 'DPF'
+
+Variables {
+ # Ticks:
+ second 1000
+ minute 60 * second
+
+ # Standard Dimensions:
+ linesize 53 # max line length, for status lines etc.
+ width100 51 # full width after padd |