Merge remote-tracking branch 'gum/master'

This commit is contained in:
lassulus 2021-08-31 19:16:11 +02:00
commit 8104c74120
10 changed files with 1330 additions and 446 deletions

View File

@ -0,0 +1,32 @@
{ lib, stdenv, fetchurl, intltool, perl, gettext, libusb-compat-0_1, pkg-config, bluez
, readline, pcsclite, libical, gtk2, glib, libXpm
, fetchpatch
}:
stdenv.mkDerivation rec {
pname = "gnokii";
version = "0.6.31";
src = fetchurl {
sha256 = "0sjjhm40662bj6j0jh3sd25b8nww54nirpwamz618rg6pb5hjwm8";
url = "https://www.gnokii.org/download/gnokii/${pname}-${version}.tar.gz";
};
patches = let
base = "https://aur.archlinux.org/cgit/aur.git/plain";
in [
(fetchpatch { url = "${base}/gnokii-gcc7.patch?h=${pname}"; sha256 = "0q1f783mxx3h212y8kqazvcy3vv4rxbvf123wy1zpsyw2z9fwsa5"; })
(fetchpatch { url = "${base}/gnokii-gcc5.patch?h=${pname}"; sha256 = "1vfsnhk37qzykx8sfilggwn1vq6iknx2r5z7rd4zrhgid2yqi2qc"; })
];
buildInputs = [
perl intltool gettext libusb-compat-0_1
glib gtk2 pkg-config bluez readline
libXpm pcsclite libical
];
meta = {
description = "Cellphone tool";
homepage = "http://www.gnokii.org";
maintainers = [ lib.maintainers.raskin ];
platforms = lib.platforms.linux;
};
}

View File

@ -15,6 +15,12 @@ let
for.minutes = min;
}
];
condition = [
{ condition = "state";
entity_id = "input_boolean.ist_sommer";
state = "off";
}
];
action =
[
{
@ -61,10 +67,19 @@ let
};
in {
services.home-assistant.config = {
sensor = [
{ platform = "season"; type = "meteorological";}
];
input_boolean = {
badezimmerfenster_lang_offen.name = "Badezimmer lange offen";
duschfenster_lang_offen.name = "Duschfenster lange offen";
ist_sommer = {
name = "Es ist Sommer";
initial = true; # TODO
};
};
automation = [
(fenster_geschlossen_lang "Badezimmerfenster" "binary_sensor.badezimmer_fenster_contact")
(fenster_geschlossen_lang "Duschfenster" "binary_sensor.dusche_fenster_contact")

View File

@ -0,0 +1,24 @@
let
relay = "switch.terrasse_plug_relay";
timeout = "300";
in {
services.home-assistant.config.automation = [
{ alias = "Always turn off Charging station after ${toString (timeout)}m";
trigger = [
{
platform = "state";
entity_id = relay;
to = "on";
for.minutes = timeout;
}
];
action =
[
{
service = "homeassistant.turn_off";
entity_id = [ relay ];
}
];
}
];
}

View File

@ -1,80 +1,7 @@
let
btn_state = light: btn: halfbright:
let
maxbright = 255;
transition = 0.2; # seconds
in
# this function implements a simple state machine based on the state and brightness of the light (light must support brightness
{
alias = "Cycle through states of ${light} via button ${btn}";
trigger = {
platform = "state";
entity_id = "sensor.${btn}_click";
to = "single";
};
action = {
choose = [
{
# state 0: off to half
conditions = {
condition = "template";
value_template = ''{{ states("${light}") == "off" }}'';
};
sequence = [
{
service = "light.turn_on";
data = {
entity_id = light;
brightness = halfbright;
};
}
];
}
{
# state 1: half to full
conditions = {
condition = "template";
value_template = ''{{ states('${light}') == 'on' and ( ${toString (halfbright - 1)} <= state_attr("${light}","brightness") <= ${toString (halfbright + 1)})}}'';
};
sequence = [
{
service = "light.turn_on";
data = {
entity_id = light;
brightness = maxbright;
};
}
];
}
{
# state 2: full to off
conditions = {
condition = "template";
# TODO: it seems like the devices respond with brightness-1 , maybe off-by-one somewhere?
value_template = ''{{ states("${light}") == "on" and state_attr("${light}","brightness") >= ${toString (maxbright - 1)}}}'';
};
sequence = [
{
service = "light.turn_off";
data = {
entity_id = light;
};
}
];
}
];
# default: on to off
# this works because state 0 checks for "state == off"
default = [{
service = "light.turn_off";
data = {
entity_id = light;
};
}];
};
};
turn_off_all = btn:
inherit (import ../lib) btn_cycle_light;
turn_off_all = btn: #lights:
{
alias = "Turn of all lights via ${btn} double click";
trigger = {
@ -84,14 +11,17 @@ let
};
action = {
service = "light.turn_off";
#entity_id = lights;
entity_id = "all";
};
};
in {
services.home-assistant.config.automation = [
# (btn_state "light.arbeitszimmerbeleuchtung" "arbeitszimmer_btn1")
(btn_state "light.schlafzimmer_komode_osram" "schlafzimmer_btn2" 128)
# (btn_state "light.wohnzimmerbeleuchtung" "wohnzimmer_btn3")
(turn_off_all "schlafzimmer_btn2")
# (btn_cycle_light "light.arbeitszimmerbeleuchtung" "arbeitszimmer_btn1")
(btn_cycle_light "light.schlafzimmer_komode_osram" "schlafzimmer_btn2" 128)
(btn_cycle_light "light.keller_osram" "keller_btn1" 128)
# (btn_cycle_light "light.wohnzimmerbeleuchtung" "wohnzimmer_btn3")
(turn_off_all "schlafzimmer_btn2" )
];
}

View File

@ -1,5 +1,4 @@
{ pkgs, lib, config, ... }:
# Ideas:
## wake-on-lan server
##
@ -33,6 +32,7 @@ in {
./automation/firetv_restart.nix
./automation/light_buttons.nix
./automation/wohnzimmer_rf_fernbedienung.nix
./automation/ladestecker_timer.nix
#./automation/giesskanne.nix
./automation/pflanzen_giessen_erinnerung.nix
#./automation/urlaub.nix

View File

@ -40,5 +40,81 @@ in
entity = "firetv";
};
};
zigbee.prefix = "/ham/zigbee";
btn_cycle_light = light: btn: halfbright:
let
maxbright = 255;
transition = 0.2; # seconds
in
# this function implements a simple state machine based on the state and brightness of the light (light must support brightness
{
alias = "Cycle through states of ${light} via button ${btn}";
trigger = {
platform = "state";
entity_id = "sensor.${btn}_click";
to = "single";
};
action = {
choose = [
{
# state 0: off to half
conditions = {
condition = "template";
value_template = ''{{ states("${light}") == "off" }}'';
};
sequence = [
{
service = "light.turn_on";
data = {
entity_id = light;
brightness = halfbright;
};
}
];
}
{
# state 1: half to full
conditions = {
condition = "template";
value_template = ''{{ states('${light}') == 'on' and ( ${toString (halfbright - 1)} <= state_attr("${light}","brightness") <= ${toString (halfbright + 1)})}}'';
};
sequence = [
{
service = "light.turn_on";
data = {
entity_id = light;
brightness = maxbright;
};
}
];
}
{
# state 2: full to off
conditions = {
condition = "template";
# TODO: it seems like the devices respond with brightness-1 , maybe off-by-one somewhere?
value_template = ''{{ states("${light}") == "on" and state_attr("${light}","brightness") >= ${toString (maxbright - 1)}}}'';
};
sequence = [
{
service = "light.turn_off";
data = {
entity_id = light;
};
}
];
}
];
# default: on to off
# this works because state 0 checks for "state == off"
default = [{
service = "light.turn_off";
data = {
entity_id = light;
};
}];
};
};
}

View File

@ -1,53 +1,38 @@
# BeEF's Gemfile
#
# Copyright (c) 2006-2018 Wade Alcorn - wade@bindshell.net
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
#gem 'simplecov', require: false, group: :test
gem 'eventmachine'
gem 'thin'
gem 'sinatra', '~> 2.0'
gem 'rack', '~> 2.0'
gem 'rack-protection', '~> 2.0'
gem 'sinatra', '>= 2.0.2'
gem 'rack', '>= 2.2.3'
gem 'rack-protection', '>= 2.0.0'
gem 'em-websocket' # WebSocket support
gem 'uglifier'
gem 'uglifier', '>= 2.7.2'
gem 'mime-types'
gem 'execjs'
gem 'ansi'
gem 'term-ansicolor', :require => 'term/ansicolor'
gem 'dm-core'
gem 'json'
gem 'data_objects'
gem 'rubyzip', '>= 1.2.1'
gem 'rubyzip', '>= 1.2.2'
gem 'espeak-ruby', '>= 1.0.4' # Text-to-Voice
gem 'nokogiri', '>= 1.7'
gem 'rake'
# SQLite support
group :sqlite do
gem 'dm-sqlite-adapter'
end
# PostgreSQL support
group :postgres do
#gem dm-postgres-adapter
end
# MySQL support
group :mysql do
#gem dm-mysql-adapter
end
gem 'nokogiri', '>= 1.11.1'
gem 'rake', '>= 12.3.3'
gem 'otr-activerecord', '>= 1.4.2'
gem 'sqlite3'
gem 'rubocop', '~> 0.92.0', require: false
# Geolocation support
group :geoip do
gem 'geoip'
gem 'maxmind-db'
end
gem 'parseconfig'
gem 'erubis'
gem 'dm-migrations'
# Metasploit Integration extension
group :ext_msf do
@ -67,12 +52,7 @@ end
# DNS extension
group :ext_dns do
gem 'rubydns', '~> 0.7.3'
end
# network extension
group :ext_network do
gem 'dm-serializer'
gem 'async-dns'
end
# QRcode extension
@ -82,24 +62,32 @@ end
# For running unit tests
group :test do
if ENV['BEEF_TEST']
gem 'test-unit'
gem 'test-unit-full'
gem 'rspec'
gem 'rdoc'
# curb gem requires curl libraries
# sudo apt-get install libcurl4-openssl-dev
gem 'curb'
# selenium-webdriver 3.x is incompatible with Firefox version 48 and prior
gem 'selenium'
gem 'selenium-webdriver', '~> 2.53.4'
# gem 'selenium' # Requires old version of selenium which is no longer available
gem 'geckodriver-helper'
gem 'selenium-webdriver'
# nokogirl is needed by capybara which may require one of the below commands
# sudo apt-get install libxslt-dev libxml2-dev
# sudo port install libxml2 libxslt
gem 'capybara'
# RESTful API tests/generic command module tests
gem 'rest-client', '>= 2.0.1'
gem 'byebug'
end
gem 'irb'
gem 'pry-byebug'
gem "websocket-client-simple", "~> 0.3.0"
gem "browserstack-local", "~> 1.3"
end
source 'https://rubygems.org'

View File

@ -1,182 +1,297 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
activemodel (6.1.4)
activesupport (= 6.1.4)
activerecord (6.1.4)
activemodel (= 6.1.4)
activesupport (= 6.1.4)
activesupport (6.1.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
ansi (1.5.0)
archive-zip (0.12.0)
io-like (~> 0.3.0)
ast (2.4.2)
async (1.30.1)
console (~> 1.10)
nio4r (~> 2.3)
timers (~> 4.1)
async-dns (1.2.6)
async-io (~> 1.15)
async-io (1.32.2)
async
browserstack-local (1.3.0)
buftok (0.2.0)
chunky_png (1.3.10)
daemons (1.2.6)
data_objects (0.10.17)
addressable (~> 2.1)
dm-core (1.2.1)
addressable (~> 2.3)
dm-do-adapter (1.2.0)
data_objects (~> 0.10.6)
dm-core (~> 1.2.0)
dm-migrations (1.2.0)
dm-core (~> 1.2.0)
dm-serializer (1.2.2)
dm-core (~> 1.2.0)
fastercsv (~> 1.5)
json (~> 1.6)
json_pure (~> 1.6)
multi_json (~> 1.0)
dm-sqlite-adapter (1.2.0)
dm-do-adapter (~> 1.2.0)
do_sqlite3 (~> 0.10.6)
do_sqlite3 (0.10.17)
data_objects (= 0.10.17)
domain_name (0.5.20180417)
byebug (11.1.3)
capybara (3.35.3)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
childprocess (3.0.0)
coderay (1.1.3)
concurrent-ruby (1.1.9)
console (1.13.1)
fiber-local
curb (0.9.11)
daemons (1.4.0)
diff-lcs (1.4.4)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
em-websocket (0.5.1)
em-websocket (0.5.2)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
equalizer (0.0.11)
erubis (2.7.0)
espeak-ruby (1.0.4)
eventmachine (1.0.9.1)
execjs (2.7.0)
fastercsv (1.5.5)
filesize (0.1.1)
geoip (1.6.4)
http (3.3.0)
event_emitter (0.2.6)
eventmachine (1.2.7)
execjs (2.8.1)
ffi (1.15.3)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
fiber-local (1.0.0)
geckodriver-helper (0.24.0)
archive-zip (~> 0.7)
hashie (4.1.0)
hashie-forbidden_attributes (0.1.1)
hashie (>= 3.0)
http (4.4.1)
addressable (~> 2.3)
http-cookie (~> 1.0)
http-form_data (~> 2.0)
http_parser.rb (~> 0.6.0)
http-cookie (1.0.3)
http-form_data (~> 2.2)
http-parser (~> 1.2.0)
http-accept (1.7.0)
http-cookie (1.0.4)
domain_name (~> 0.5)
http-form_data (2.1.1)
http-form_data (2.3.0)
http-parser (1.2.3)
ffi-compiler (>= 1.0, < 2.0)
http_parser.rb (0.6.0)
jsobfu (0.4.2)
rkelly-remix
json (1.8.6)
json_pure (1.8.6)
i18n (1.8.10)
concurrent-ruby (~> 1.0)
io-console (0.5.9)
io-like (0.3.1)
irb (1.3.6)
reline (>= 0.2.5)
json (2.5.1)
maxmind-db (1.1.1)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
metasm (1.0.3)
mime-types (3.2.2)
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2018.0812)
mini_portile2 (2.3.0)
mojo_magick (0.5.6)
msfrpc-client (1.1.1)
mime-types-data (3.2021.0704)
mini_mime (1.1.0)
mini_portile2 (2.6.1)
minitest (5.14.4)
mojo_magick (0.6.6)
msfrpc-client (1.1.2)
msgpack (~> 1)
rex (~> 2)
msgpack (1.2.4)
multi_json (1.13.1)
multipart-post (2.0.0)
mustermann (1.0.2)
msgpack (1.4.2)
multipart-post (2.1.1)
mustermann (1.1.1)
ruby2_keywords (~> 0.0.1)
naught (1.1.0)
netrc (0.11.0)
nokogiri (1.8.4)
mini_portile2 (~> 2.3.0)
parseconfig (1.0.8)
public_suffix (3.0.3)
qr4r (0.4.1)
mojo_magick
rqrcode
rack (2.0.5)
rack-protection (2.0.3)
nio4r (2.5.8)
nokogiri (1.12.2)
mini_portile2 (~> 2.6.1)
racc (~> 1.4)
otr-activerecord (2.0.1)
activerecord (>= 4.0, < 6.3)
hashie-forbidden_attributes (~> 0.1)
parallel (1.20.1)
parseconfig (1.1.0)
parser (3.0.2.0)
ast (~> 2.4.1)
power_assert (2.0.0)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
public_suffix (4.0.6)
qr4r (0.6.1)
mojo_magick (~> 0.6.5)
rqrcode_core (~> 0.1)
racc (1.5.2)
rack (2.2.3)
rack-protection (2.1.0)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rainbow (3.0.0)
rake (12.3.1)
rb-readline (0.5.5)
rest-client (2.0.2)
rake (13.0.6)
rdoc (6.3.2)
regexp_parser (2.1.1)
reline (0.2.6)
io-console (~> 0.5)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rex (2.0.11)
filesize
jsobfu (~> 0.4.1)
json
metasm (~> 1.0.2)
nokogiri
rb-readline
robots
rexec (1.6.3)
rainbow
rkelly-remix (0.0.7)
robots (0.10.1)
rqrcode (0.10.1)
chunky_png (~> 1.0)
rubydns (0.7.3)
eventmachine (~> 1.0.0)
rexec (~> 1.6.2)
rubyzip (1.2.1)
rexml (3.2.5)
rqrcode_core (0.2.0)
rr (3.0.5)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.2)
rubocop (0.92.0)
parallel (~> 1.10)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
rubocop-ast (>= 0.5.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.8.0)
parser (>= 3.0.1.1)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
rushover (0.3.0)
json
rest-client
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
simple_oauth (0.3.1)
sinatra (2.0.3)
sinatra (2.1.0)
mustermann (~> 1.0)
rack (~> 2.0)
rack-protection (= 2.0.3)
rack (~> 2.2)
rack-protection (= 2.1.0)
tilt (~> 2.0)
slack-notifier (2.3.2)
term-ansicolor (1.6.0)
slack-notifier (2.4.0)
sqlite3 (1.4.2)
sync (0.5.0)
term-ansicolor (1.7.1)
tins (~> 1.0)
thin (1.7.2)
test-unit (3.4.4)
power_assert
test-unit-context (0.5.1)
test-unit (>= 2.4.0)
test-unit-full (0.0.5)
test-unit
test-unit-context
test-unit-notify
test-unit-rr
test-unit-runner-tap
test-unit-notify (1.0.4)
test-unit (>= 2.4.9)
test-unit-rr (1.0.5)
rr (>= 1.1.1)
test-unit (>= 2.5.2)
test-unit-runner-tap (1.1.2)
test-unit
thin (1.8.1)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
thread_safe (0.3.6)
tilt (2.0.8)
tins (1.16.3)
twitter (6.2.0)
tilt (2.0.10)
timers (4.3.3)
tins (1.29.1)
sync
twitter (7.0.0)
addressable (~> 2.3)
buftok (~> 0.2.0)
equalizer (~> 0.0.11)
http (~> 3.0)
http (~> 4.0)
http-form_data (~> 2.0)
http_parser.rb (~> 0.6.0)
memoizable (~> 0.4.0)
multipart-post (~> 2.0)
naught (~> 1.0)
simple_oauth (~> 0.3.0)
uglifier (4.1.18)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
xmlrpc (0.3.0)
unf_ext (0.0.7.7)
unicode-display_width (1.7.0)
webrick (1.7.0)
websocket (1.2.9)
websocket-client-simple (0.3.0)
event_emitter
websocket
xmlrpc (0.3.2)
webrick
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.4.2)
PLATFORMS
ruby
DEPENDENCIES
ansi
data_objects
dm-core
dm-migrations
dm-serializer
dm-sqlite-adapter
async-dns
browserstack-local (~> 1.3)
capybara
curb
em-websocket
erubis
espeak-ruby (>= 1.0.4)
eventmachine
execjs
geoip
geckodriver-helper
irb
json
maxmind-db
mime-types
msfrpc-client
nokogiri (>= 1.7)
nokogiri (>= 1.11.1)
otr-activerecord (>= 1.4.2)
parseconfig
pry-byebug
qr4r
rack (~> 2.0)
rack-protection (~> 2.0)
rake
rubydns (~> 0.7.3)
rubyzip (>= 1.2.1)
rack (>= 2.2.3)
rack-protection (>= 2.0.0)
rake (>= 12.3.3)
rdoc
rest-client (>= 2.0.1)
rspec
rubocop (~> 0.92.0)
rubyzip (>= 1.2.2)
rushover
sinatra (~> 2.0)
selenium-webdriver
sinatra (>= 2.0.2)
slack-notifier
sqlite3
term-ansicolor
test-unit
test-unit-full
thin
twitter (>= 5.0.0)
uglifier
uglifier (>= 2.7.2)
websocket-client-simple (~> 0.3.0)
xmlrpc
BUNDLED WITH
1.14.6
2.1.4

File diff suppressed because it is too large Load Diff

28
makefu/5pkgs/beef/update.sh Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl bundix git libiconv libpcap libxml2 libxslt pkg-config postgresql ruby.devEnv sqlite xmlstarlet nix-update wget
set -eu -o pipefail
cd "$(dirname "$(readlink -f "$0")")"
# TODO find the correct tag
echo Fetching latest Gemfile
wget https://raw.githubusercontent.com/beefproject/beef/master/Gemfile -O Gemfile
rm -f Gemfile.lock
echo Running bundler install
bundler install
echo Running bundix
bundix
exit 0
latest=$(curl https://github.com/rapid7/metasploit-framework/releases.atom | xmlstarlet sel -N atom="http://www.w3.org/2005/Atom" -t -m /atom:feed/atom:entry -v atom:title -n | head -n1)
echo "Updating metasploit to $latest"
sed -i "s#refs/tags/.*#refs/tags/$latest\"#" Gemfile
bundler install
bundix
sed -i '/[ ]*dependencies =/d' gemset.nix
cd "../../../../"
nix-update beef --version "$latest"