<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3273900571922875014</id><updated>2024-10-24T21:09:16.647+02:00</updated><category term="Windows"/><category term="A1"/><category term="ADB"/><category term="ADSL"/><category term="Backup"/><category term="Buffalo"/><category term="Cisco"/><category term="Client"/><category term="FreeFileSync"/><category term="Linkstation"/><category term="NAS"/><category term="VPN"/><category term="VV2220"/><category term="WOL"/><category term="Wake On LAN"/><category term="Windows7"/><category term="adbstats"/><category term="bash"/><category term="batch"/><category term="curl"/><category term="duration"/><category term="gpio"/><category term="html2text"/><category term="ini"/><category term="modem"/><category term="pi"/><category term="press"/><category term="python"/><category term="raspberry"/><category term="switch"/><category term="tactile"/><category term="vbscript"/><title type='text'>≠ logic</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://irregular-logic.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3273900571922875014/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://irregular-logic.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>≠ logic - Clemens</name><uri>http://www.blogger.com/profile/16080200567497209790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3273900571922875014.post-3706216474187972962</id><published>2017-09-13T13:29:00.000+02:00</published><updated>2017-09-13T13:29:00.707+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="duration"/><category scheme="http://www.blogger.com/atom/ns#" term="gpio"/><category scheme="http://www.blogger.com/atom/ns#" term="pi"/><category scheme="http://www.blogger.com/atom/ns#" term="press"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="raspberry"/><category scheme="http://www.blogger.com/atom/ns#" term="switch"/><category scheme="http://www.blogger.com/atom/ns#" term="tactile"/><title type='text'>Raspberry Pi detect keypress(es) and duration</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Today I started my first Raspberry Pi project which involves HW (tactile switch). Setting up the required components on a proto board turned out to be less complex as expected, but when searching for python code to detect long/short keypress events (and eventually measure the time as well) I&#39;ve not found nothing really useful. Thus I decided to accept the challenge and implement my own solution to distinguish between long an short key presses (via callback function) and to measure the time in ms.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;import os
import RPi.GPIO as GPIO
import time

longpress_ctms=lambda: int(round(time.time()*1000))
longpress_cfg={}
longpress_event={}

def longpress_add(channel,bt,min,longcb,shortcb):
    global longpress_cfg

    longpress_cfg[channel]=dict({&#39;bt&#39;:bt,&#39;min&#39;:min,&#39;lcb&#39;:longcb,&#39;scb&#39;:shortch})
    GPIO.setup(channel,GPIO.IN,pull_up_down=GPIO.PUD_DOWN)
    GPIO.add_event_detect(channel,GPIO.BOTH,callback=longpress_cb,bouncetime=longpress_cfg[channel][&#39;bt&#39;])

def longpress_cb(channel):
    if GPIO.input(channel):
        longpress_press(channel)
    else:
        longpress_release(channel)
    
def longpress_press(channel):
    global longpress_event

    longpress_event[channel]=longpress_ctms()

def longpress_release(channel):
    global longpress_event
    
    dur=longpress_ctms()-longpress_event[channel]
    if dur&amp;gt;=longpress_cfg[channel][&#39;min&#39;]:
        longpress_cfg[channel][&#39;lcb&#39;](channel,dur)
    else:
        longpress_cfg[channel][&#39;scb&#39;](channel,dur)

# Callbacks
def long(channel,duration):
    print &#39;Long press for channel &#39;+str(channel)+&#39; (&#39;+str(duration)+&#39;ms)&#39;

def short(channel,duration):
    print &#39;Short press for channel &#39;+str(channel)+&#39; (&#39;+str(duration)+&#39;ms)&#39;

&lt;b&gt;# Init
GPIO.setmode(GPIO.BCM)
longpress_add(18,75,1000,long,short)
longpress_add(23,75,1000,long,short)&lt;/b&gt;

# Main loop
try:
    while True:
        time.sleep(1000)
except KeyboardInterrupt:
    pass
finally:
    GPIO.cleanup()

&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Parameters for &quot;longpress_add&quot; are:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;channel - channel/pin to detect keypress for&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;bt - minimum time (bouncetime) between two callbacks in milliseconds&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;min - minimum duration for long presses&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;longcb - callback for long presses&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;shortcb - callback for short presses&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Running the python script from above (for channel 18&amp;nbsp;+ 23) I do get the following output:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;$ python longpress.py&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Short press for channel 18 (551ms)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Long press for channel 18 (2683ms)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Short press for channel 23 (312ms)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Long press for channel 23 (2081ms)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;^C&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I hope this post inspires you to create some fancy Raspberry Pi solutions as well and to share them with the community.&lt;br /&gt;
&lt;br /&gt;
PS:&amp;nbsp;This is one of my first python scripts ever, so please be gentle if there are some coding issues ...&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://irregular-logic.blogspot.com/feeds/3706216474187972962/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3273900571922875014/3706216474187972962' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3273900571922875014/posts/default/3706216474187972962'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3273900571922875014/posts/default/3706216474187972962'/><link rel='alternate' type='text/html' href='http://irregular-logic.blogspot.com/2017/09/raspberry-pi-detect-keypresses-and.html' title='Raspberry Pi detect keypress(es) and duration'/><author><name>≠ logic - Clemens</name><uri>http://www.blogger.com/profile/16080200567497209790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3273900571922875014.post-1340909555499220752</id><published>2017-06-20T13:07:00.000+02:00</published><updated>2017-06-20T13:24:42.017+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="A1"/><category scheme="http://www.blogger.com/atom/ns#" term="ADB"/><category scheme="http://www.blogger.com/atom/ns#" term="adbstats"/><category scheme="http://www.blogger.com/atom/ns#" term="ADSL"/><category scheme="http://www.blogger.com/atom/ns#" term="bash"/><category scheme="http://www.blogger.com/atom/ns#" term="curl"/><category scheme="http://www.blogger.com/atom/ns#" term="html2text"/><category scheme="http://www.blogger.com/atom/ns#" term="modem"/><category scheme="http://www.blogger.com/atom/ns#" term="VV2220"/><title type='text'>ADB VV 2220 - Read statistics via bash</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
My beloved Pirelli PRGAV4202N modem died and I had to replace it with the (A1 branded)&amp;nbsp;ADB VV2220 (v2/Firmware: E_9.4.1). In the past I&#39;ve already created a couple of scripts to read current statistics, etc. but these are worthless now.&amp;nbsp;Time for some hands-on!&lt;br /&gt;
&lt;br /&gt;
So my first goal was to read the&amp;nbsp;Diagnostic/Interfaces summary, but it turned out to be a little more complicated as expected, as the logon process requires some additional form fields (sha256 hash of the password, etc.) which are pre filled using javascript. In order to mimic this behaviour we first have to extract some values from the login page:&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;page=$(curl -v -k http://&lt;b&gt;10.0.0.138&lt;/b&gt;/ui/login 2&amp;gt;&amp;amp;1)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;nonce=$(echo &quot;$page&quot; | grep &#39;name=&quot;nonce&quot;&#39; | egrep -o &#39;value=&quot;(.*)&quot;&#39; | sed -n -E &#39;s/value=&quot;(.*)&quot;/\1/p&#39;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;code1=$(echo &quot;$page&quot; | grep &#39;name=&#39;\&#39;&#39;code1&#39;\&#39;&#39;&#39; | egrep -o &#39;value=&#39;\&#39;&#39;(.*)&#39;\&#39;&#39;&#39; | sed -n -E &#39;s/value=&#39;\&#39;&#39;(.*)&#39;\&#39;&#39;/\1/p&#39;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;code3=$(echo &quot;$page&quot; | grep &#39;name=&#39;\&#39;&#39;code3&#39;\&#39;&#39;&#39; | egrep -o &#39;value=&#39;\&#39;&#39;(.*)&#39;\&#39;&#39;&#39; | sed -n -E &#39;s/value=&#39;\&#39;&#39;(.*)&#39;\&#39;&#39;/\1/p&#39;)&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now I use the PHP function &quot;hash_hmac&quot; to create the sha256 hash (openssl could be used as well):&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;passwd=$(php -r &quot;echo hash_hmac(&#39;sha256&#39;,&#39;&lt;b&gt;Austria&amp;amp;Eur0&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&#39;,&#39;$nonce&#39;);&quot;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Using the hashed password we can now sign in and fetch the new session ID:&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;sid=$(curl -k -v -X POST -H &quot;Content-Type: application/x-www-form-urlencoded&quot; -d &quot;login=Login&amp;amp;userName=&lt;b&gt;Telek0m&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;amp;userPwd=$passwd&amp;amp;nonce=$nonce&amp;amp;code1=$code1&amp;amp;code3=$code3&quot; http://$1/ui/login 2&amp;gt;&amp;amp;1 | grep &quot;Set-Cookie:&quot; | sed -n -E &#39;s/.*Set-Cookie:.*sid=([^;]*).*/\1/p&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Using the session ID you have switch to enhanced mode first (seems to be requires as otherwise calling the diagnostics URI&#39;s ins&#39;t working), then fetch the &quot;Diagnostic/Interfaces summary&quot; and output it using&amp;nbsp;html2text:&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;echo $(curl -k -v --header &quot;Cookie: sid=$sid&quot; &quot;http://$1/ui/dboard?level=2&quot;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;echo &quot;$(curl --header &quot;Cookie: sid=$sid&quot; &quot;http://$1/ui/dboard/diagnostics/ifsummary?backto=diagnostics&amp;amp;p=1&quot; 2&amp;gt;/dev/null | html2text -style pretty -o - )&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Voila here it is:&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjSZS0qb3lqaLkOr9OEtM2U5aXxZgdjp72_Gq0b4655FO5T8qVEatEZht12QxGlYRPuAaRnZJ7gq5o4_k1K9d7bJk8mv9bhjrFy-r_TgwpAfUICogQpiPweFo_5QUp2XQpdm5DXs9gsbQ/s1600/voila.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;558&quot; data-original-width=&quot;949&quot; height=&quot;235&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjSZS0qb3lqaLkOr9OEtM2U5aXxZgdjp72_Gq0b4655FO5T8qVEatEZht12QxGlYRPuAaRnZJ7gq5o4_k1K9d7bJk8mv9bhjrFy-r_TgwpAfUICogQpiPweFo_5QUp2XQpdm5DXs9gsbQ/s400/voila.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Interface summary&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
I&#39;ve add the complete script (output is refreshed every 5s) below and A1 users in Austria can call it (others most likely have to adjust the command line parameters):&lt;br /&gt;
&lt;br /&gt;
&lt;style type=&quot;text/css&quot;&gt;
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}
span.s1 {font-variant-ligatures: no-common-ligatures}
&lt;/style&gt;


&lt;br /&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;span class=&quot;s1&quot;&gt;./adbstats.sh &quot;&lt;b&gt;10.0.0.138&quot;&lt;/b&gt; &quot;&lt;b&gt;Telek0m&lt;/b&gt;&quot; &quot;&lt;b&gt;Austria&amp;amp;Eur0&lt;/b&gt;&quot;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I hope this post inspired you to create some fancy scripts as well (e.g. periodic reboot, etc.) and to share them with the community.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Cheers&lt;/div&gt;
&lt;div&gt;
&lt;h2 class=&quot;OYKEW4D-S-k&quot; style=&quot;border: 0px; color: #222222; display: table-cell; font-family: Arial, Helvetica, sans-serif; font-size: 18px; font-weight: inherit; margin: 0px; padding: 0px 10px 0px 0px; vertical-align: baseline; white-space: nowrap; width: 1px;&quot;&gt;
&lt;a class=&quot;OYKEW4D-S-b blogg-title&quot; href=&quot;https://www.blogger.com/blogger.g?blogID=3273900571922875014#allposts&quot; style=&quot;border: 0px; color: #333333; display: inline-block; font-family: &amp;quot;Open Sans&amp;quot;, Helvetica, Arial, sans-serif; font-style: inherit; height: 24px; line-height: 24px; margin: 0px; max-width: 170px; overflow: hidden; padding: 0px; text-decoration-line: none; text-overflow: ellipsis; vertical-align: middle;&quot;&gt;≠ logic&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;style type=&quot;text/css&quot;&gt;
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}
span.s1 {font-variant-ligatures: no-common-ligatures}
&lt;/style&gt;


&lt;br /&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;span class=&quot;s1&quot;&gt;&lt;b&gt;adbstats.sh&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;#!/bin/bash&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;page=$(curl -v -k http://$1/ui/login 2&amp;gt;&amp;amp;1)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;nonce=$(echo &quot;$page&quot; | grep &#39;name=&quot;nonce&quot;&#39; | egrep -o &#39;value=&quot;(.*)&quot;&#39; | sed -n -E &#39;s/value=&quot;(.*)&quot;/\1/p&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;code1=$(echo &quot;$page&quot; | grep &#39;name=&#39;\&#39;&#39;code1&#39;\&#39;&#39;&#39; | egrep -o &#39;value=&#39;\&#39;&#39;(.*)&#39;\&#39;&#39;&#39; | sed -n -E &#39;s/value=&#39;\&#39;&#39;(.*)&#39;\&#39;&#39;/\1/p&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;code3=$(echo &quot;$page&quot; | grep &#39;name=&#39;\&#39;&#39;code3&#39;\&#39;&#39;&#39; | egrep -o &#39;value=&#39;\&#39;&#39;(.*)&#39;\&#39;&#39;&#39; | sed -n -E &#39;s/value=&#39;\&#39;&#39;(.*)&#39;\&#39;&#39;/\1/p&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;# Use php to create hash&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;passwd=$(php -r &quot;echo hash_hmac(&#39;sha256&#39;,&#39;$3&#39;,&#39;$nonce&#39;);&quot;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;sid=$(curl -k -v -X POST -H &quot;Content-Type: application/x-www-form-urlencoded&quot; -d &quot;login=Login&amp;amp;userName=$2&amp;amp;userPwd=$passwd&amp;amp;nonce=$nonce&amp;amp;code1=$code1&amp;amp;code3=$code3&quot; http://$1/ui/login 2&amp;gt;&amp;amp;1 | grep &quot;Set-Cookie:&quot; | sed -n -E &#39;s/.*Set-Cookie:.*sid=([^;]*).*/\1/p&#39;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;# Switch to advanced mode&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;echo $(curl -k -v --header &quot;Cookie: sid=$sid&quot; &quot;http://$1/ui/dboard?level=2&quot;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;while true&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;do&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; clear&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; echo &quot;$(curl --header &quot;Cookie: sid=$sid&quot; &quot;http://$1/ui/dboard/diagnostics/ifsummary?backto=diagnostics&amp;amp;p=1&quot; 2&amp;gt;/dev/null | html2text -style pretty -o - )&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;&amp;nbsp; &amp;nbsp; Sleep 5&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: xx-small;&quot;&gt;done&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;style type=&quot;text/css&quot;&gt;
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff; min-height: 13.0px}
span.s1 {font-variant-ligatures: no-common-ligatures}
&lt;/style&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://irregular-logic.blogspot.com/feeds/1340909555499220752/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3273900571922875014/1340909555499220752' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3273900571922875014/posts/default/1340909555499220752'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3273900571922875014/posts/default/1340909555499220752'/><link rel='alternate' type='text/html' href='http://irregular-logic.blogspot.com/2017/06/adb-vv-2220-read-statistics-via-bash.html' title='ADB VV 2220 - Read statistics via bash'/><author><name>≠ logic - Clemens</name><uri>http://www.blogger.com/profile/16080200567497209790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjSZS0qb3lqaLkOr9OEtM2U5aXxZgdjp72_Gq0b4655FO5T8qVEatEZht12QxGlYRPuAaRnZJ7gq5o4_k1K9d7bJk8mv9bhjrFy-r_TgwpAfUICogQpiPweFo_5QUp2XQpdm5DXs9gsbQ/s72-c/voila.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3273900571922875014.post-8711327104689202320</id><published>2011-09-27T10:12:00.000+02:00</published><updated>2011-09-27T16:47:40.408+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Cisco"/><category scheme="http://www.blogger.com/atom/ns#" term="Client"/><category scheme="http://www.blogger.com/atom/ns#" term="ini"/><category scheme="http://www.blogger.com/atom/ns#" term="VPN"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows"/><title type='text'>Cisco VPN Client - Auto-connect &amp; remember password</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
My ISP disconnects the DSL line every 8 hours (+new public IP) and thus my company VPN connection is disconnected as well. As this is very annoying I configured my VPN Client (Windows, 5.0.07.0410) to automatically connect and to remember my password.&lt;br /&gt;
&lt;br /&gt;To enable auto-connect (Automatic VPN Initiation) edit the file vpnclient.ini (for my case this file is located in folder &quot;C:\Program Files\Cisco Systems\VPN Client&quot;) and add the following lines:&lt;br /&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;AutoInitiationEnable=1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;AutoInitiationRetryInterval=15&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;AutoInitiationRetryIntervalType=1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;AutoInitiationList=&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;aconn&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;EnableLog=0&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;aconn&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;ConnectionEntry=&lt;i&gt;MyCompany&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;Connect=1&lt;/span&gt;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The param &quot;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;AutoInitiationRetryInterval&lt;/span&gt;&quot; is used to set the reconnect interval (in minutes or seconds) depending on &quot;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;AutoInitiationRetryIntervalType&lt;/span&gt;&quot; where 0=minutes and 1=seconds.&lt;br /&gt;
I created a new ini section named &quot;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;aconn&lt;/span&gt;&quot; for my connection entry &quot;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;MyCompany&lt;/span&gt;&quot; (points to a connection profile named &quot;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;MyCompany.pcf&quot;&lt;/span&gt;), here you simply replace &quot;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;MyCompany&lt;/span&gt;&quot; with the name of your connection entry (fyi, you can add multiple ini sections comma separated to param &quot;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;AutoInitiationList&lt;/span&gt;&quot;).&lt;br /&gt;
&lt;br /&gt;
Regarding remembering the password the admin can override your settings in the remote profile (which happend in my case), so I had to do a little trick here. Exit the VPN client and open the respective local profile file (for my case the profile files are located in folder &quot;C:\Program Files\Cisco Systems\VPN Client\Profiles&quot;) and add the following lines:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;SaveUserPassword=1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;UserPassword=&lt;i&gt;mySecret&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;enc_UserPassword=&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;...&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Set param &quot;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;UserPassword&lt;/span&gt;&quot; to your actual password, safe the file and make the profile file READ ONLY, because whenever you connect successfully the remote profile settings will override some of your local settings! &lt;br /&gt;&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;NOTE: Please do not forget to remove the read only flag whenever you want to edit the profile.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Now the VPN client should now automatically (re)connect.&amp;nbsp;I know that this mini HowTo&amp;nbsp;is not the sorcerer&#39;s stone, but I hope it saves you from waste of time for googling around and trial&amp;amp;error.&lt;br /&gt;
&lt;br /&gt;br&lt;br /&gt;&lt;a class=&quot;GA10RCSDDB blogg-title&quot; href=&quot;http://www.blogger.com/blogger.g?blogID=3273900571922875014#allposts&quot; style=&quot;background-color: #f3f3f3; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #333333; cursor: pointer; display: inline-block; font-family: &#39;Open Sans&#39;, Helvetica, Arial, sans-serif; font-size: 18px; height: 24px; line-height: 24px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-width: 170px; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: hidden; overflow-y: hidden; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; text-decoration: none; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap;&quot;&gt;≠ logic&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;References:&lt;br /&gt;&lt;a href=&quot;http://www.cisco.com/en/US/docs/security/vpn_client/cisco_vpn_client/vpn_client46/administration/guide/vcAch4.html&quot;&gt;http://www.cisco.com/en/US/docs/security/vpn_client/cisco_vpn_client/vpn_client46/administration/guide/vcAch4.html&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://irregular-logic.blogspot.com/feeds/8711327104689202320/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3273900571922875014/8711327104689202320' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3273900571922875014/posts/default/8711327104689202320'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3273900571922875014/posts/default/8711327104689202320'/><link rel='alternate' type='text/html' href='http://irregular-logic.blogspot.com/2011/09/cisco-vpn-client-auto-connect-remember.html' title='Cisco VPN Client - Auto-connect &amp; remember password'/><author><name>≠ logic - Clemens</name><uri>http://www.blogger.com/profile/16080200567497209790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3273900571922875014.post-5450702455113842601</id><published>2011-09-21T14:15:00.001+02:00</published><updated>2011-09-30T16:25:18.137+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Backup"/><category scheme="http://www.blogger.com/atom/ns#" term="batch"/><category scheme="http://www.blogger.com/atom/ns#" term="Buffalo"/><category scheme="http://www.blogger.com/atom/ns#" term="FreeFileSync"/><category scheme="http://www.blogger.com/atom/ns#" term="Linkstation"/><category scheme="http://www.blogger.com/atom/ns#" term="NAS"/><category scheme="http://www.blogger.com/atom/ns#" term="vbscript"/><category scheme="http://www.blogger.com/atom/ns#" term="Wake On LAN"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows7"/><category scheme="http://www.blogger.com/atom/ns#" term="WOL"/><title type='text'>FreeFileSync - Wake On LAN for NAS (Buffalo LinkStation™ Duo)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Last week after my&amp;nbsp;hard-disk&amp;nbsp;crashed and I realized that my backups are outdated, I decided to do it right this time. So I purchased a Buffalo Link Station Duo (2TB,Raid1, good price-performance ratio) as backup device and was&amp;nbsp;absolutely convinced that with a few clicks I could easily setup a pure Windows based backup scenario.&lt;br /&gt;
But first of all my Windows7 Home Premium doesn&#39;t support SyncCenter and the second issue is that I was not happy with the &quot;NAS PM Service&quot;, which caused the NAS station to start-up when ever I turned on my PC. This almost&amp;nbsp;jeopardized my initial idea, because all I wanted to achieve was to activate the NAS, run the backup and&amp;nbsp;finally&amp;nbsp;shutdown the NAS until the next time the scheduler runs.&lt;br /&gt;
Time for some hands-on!&lt;br /&gt;
&lt;br /&gt;
So here is &lt;u&gt;my solution&lt;/u&gt; which works without the Buffalo NASNavi Suite and may work for other vendors/products as well:&lt;br /&gt;
&lt;br /&gt;
In combination with t&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;he utility&amp;nbsp;WolCmd.exe I created 2 additional scripts (WOL.bat,WOL.svn) which I use to wake-up and/or&amp;nbsp;keep-alive&amp;nbsp;the NAS. Simply download&amp;nbsp;WolCmd.exe, create&amp;nbsp;WOL.bat, WOL.svn (find source code below) and copy the files to (&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;for now the directory is&amp;nbsp;hard coded&lt;/span&gt;)&amp;nbsp;C:\Program Files\Utils. Once this is done you can use WOL.bat for&lt;/span&gt; ...&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;u&gt;Linkstation wakeup&lt;/u&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;tt&gt;&quot;C:\Program Files\Utils\WOL.bat&quot; wol [MAC] [IP] [NetMask] [Port] [Runs] [Interval in seconds]&lt;/tt&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Example:&lt;/i&gt;&lt;br /&gt;
&lt;tt&gt;&quot;C:\Program Files\Utils\WOL.bat&quot; wol
      4ce6XXXXXXXX 10.0.0.XX 255.255.255.0 9 5 45&lt;/tt&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;u&gt;Start Linkstation keepalive&lt;/u&gt;&lt;/i&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;i&gt;&lt;tt&gt;&quot;C:\Program Files\Utils\WOL.bat&quot; start [jobID]&amp;nbsp;&lt;/tt&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;tt&gt;[IP] [NetMask] [Port] [Interval in seconds]&lt;/tt&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Example:&lt;/i&gt;&lt;br /&gt;
&lt;tt&gt;&quot;C:\Program Files\Utils\WOL.bat&quot;&amp;nbsp;&lt;/tt&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt;start backup&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt;4ce6XXXXXXXX 10.0.0.XX 255.255.255.0 9 5&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;u&gt;Stop&amp;nbsp;&lt;i&gt;Linkstation keepalive&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;i&gt;&lt;tt&gt;&quot;C:\Program Files\Utils\WOL.bat&quot; end [jobID]&lt;/tt&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;i&gt;Example:&lt;/i&gt;&lt;br /&gt;
&lt;tt&gt;&quot;C:\Program Files\Utils\WOL.bat&quot;&amp;nbsp;&lt;/tt&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt;end backup&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Using the Windows Task Scheduler and FreeFileSync I now run a daily backup and the&amp;nbsp;Linkstation&amp;nbsp;is only active while&amp;nbsp;FreeFileSync runs (+ a couple of minutes until it shuts down). The image below shall give you an idea how to use WOL.bat to&amp;nbsp;wake-up (duration 5*45s) and keep-alive (5s interval) your Linkstation while your e.g. backup executes.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6OcGF6WGSGqqUOW081VcXI1wERR6EZKvXFLPKHYzZPkIZNgzvYTh_Bl3KTw_Sa_1RZxZxJt45H-GYW9eRJTuG2HM4pqrbrKT7lDLaS6-owI726RAIyYJmVxC9E4HvE4zmQ0ZOW9NAUVg/s1600/TaskScheduler.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;266&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6OcGF6WGSGqqUOW081VcXI1wERR6EZKvXFLPKHYzZPkIZNgzvYTh_Bl3KTw_Sa_1RZxZxJt45H-GYW9eRJTuG2HM4pqrbrKT7lDLaS6-owI726RAIyYJmVxC9E4HvE4zmQ0ZOW9NAUVg/s400/TaskScheduler.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
I hope this information is useful for you, helps to conserve energy and please&amp;nbsp;apologize if there are typo(s), grammar error(s), etc. because my native language is German (and this is my first blog entry).&lt;/div&gt;
&lt;br /&gt;
br&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #f3f3f3; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 18px;&quot;&gt;&lt;a class=&quot;GNW4IDEBBCB blogg-title&quot; href=&quot;http://www.blogger.com/blogger.g?blogID=3273900571922875014#allposts&quot; style=&quot;border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #333333; display: inline-block; font-family: &#39;Open Sans&#39;, Helvetica, Arial, sans-serif; font-size: 18px; font-style: inherit; height: 24px; line-height: 24px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-width: 170px; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: hidden; overflow-y: hidden; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap;&quot;&gt;≠ logic&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Software&lt;/li&gt;
&lt;/ul&gt;
&lt;i&gt;FreeFileSync &lt;/i&gt;-&amp;nbsp;&lt;a href=&quot;http://sourceforge.net/projects/freefilesync/&quot;&gt;http://sourceforge.net/projects/freefilesync/&lt;/a&gt;&lt;br /&gt;
WolCmd.exe -&amp;nbsp;&lt;a href=&quot;http://www.depicus.com/wake-on-lan/wake-on-lan-cmd.aspx&quot;&gt;http://www.depicus.com/wake-on-lan/wake-on-lan-cmd.aspx&lt;/a&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Scripts&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;&lt;u&gt;WOL.bat&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/b&gt;&lt;tt&gt;@ECHO OFF&lt;br /&gt;
      &lt;br /&gt;
      IF /I &quot;%1&quot;==&quot;__myself&quot; (&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; FOR /L %%l IN (0,0,0) DO (&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: WOL command example -- &quot;C:\Program
      Files\Utils\WolCmd.exe&quot; 4ce67696094b 10.0.0.62 255.255.255.0 9&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;C:\Program Files\Utils\WolCmd.exe&quot; %3 %4 %5 %6&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: Delay for n (&amp;gt;1) seconds&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ping -n %7 127.0.0.1 &amp;gt; nul&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;
      &lt;br /&gt;
      ) ELSE (&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; SET prefix=w0L_-&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; SET postfix=-_L0w&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; IF /I &quot;%1&quot;==&quot;start&quot; (&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: ECHO %0 __myself %prefix%%2%postfix% %3 %4 %5 %6 %7&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; START &quot;%2&quot; /I /MIN cmd.exe /C %0 __myself
      %prefix%%2%postfix% %3 %4 %5 %6 %7&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; ) ELSE (&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF /I &quot;%1&quot;==&quot;end&quot; (&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; START &quot;Kill: %2&quot; /I cmd.exe /C cscript &quot;%~dp0WOL.vbs&quot;
      %prefix%%2%postfix%&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) ELSE (&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF /I &quot;%1&quot;==&quot;wol&quot; (&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FOR /L %%l IN (%6,-1,1) DO (&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: WOL command example -- &quot;C:\Program
      Files\Utils\WolCmd.exe&quot; 4ce67696094b 10.0.0.62 255.255.255.0 9&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;C:\Program Files\Utils\WolCmd.exe&quot; %2 %3 %4
      %5&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: Delay for n (&amp;gt;1) seconds&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ping -n %7 127.0.0.1 &amp;gt; nul&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;
      )&lt;/tt&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;WOL.vbs&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/b&gt;
    &lt;tt&gt;Set oShell = CreateObject(&quot;WScript.Shell&quot;)&lt;br /&gt;
      &lt;br /&gt;
      if WScript.Arguments.Count &amp;gt;= 1 then&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim objWMIService&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; Set objWMIService = GetObject(&quot;winmgmts:&quot; &amp;amp;
      &quot;{impersonationLevel=impersonate}!\\&quot; &amp;amp; &quot;.&quot; &amp;amp;
      &quot;\root\cimv2&quot;)&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim colProcess&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; Set colProcess = objWMIService.ExecQuery (&quot;Select * from
      Win32_Process Where Name = &#39;cmd.exe&#39;&quot;)&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; For Each objProcess in colProcess&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim re1,re2&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set re1 = new RegExp&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set re2 = new RegExp&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; re1.Pattern = &quot;.*[ ]{1}__myself[ ]{1}.*&quot;&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; re2.Pattern = &quot;.*[ ]{1}&quot; &amp;amp; WScript.Arguments(0) &amp;amp;
      &quot;[ ]{1}.*&quot;&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim m1,m2&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set m1 = re1.Execute(objProcess.CommandLine)&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set m2 = re2.Execute(objProcess.CommandLine)&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WSCript.Echo m1.Count &amp;amp; &quot;|&quot; &amp;amp; re1.Pattern &amp;amp;
      &quot;|&quot; &amp;amp; objProcess.CommandLine&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WSCript.Echo m2.Count &amp;amp; &quot;|&quot; &amp;amp; re2.Pattern &amp;amp;
      &quot;|&quot; &amp;amp; objProcess.CommandLine&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if m1.Count &amp;gt; 0 AND m2.Count &amp;gt; 0 then&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WSCript.Echo objProcess.CommandLine&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objProcess.Terminate()&lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Quit()&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if&lt;br /&gt;
      &lt;br /&gt;
      &amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;br /&gt;
      &lt;br /&gt;
      end if&lt;/tt&gt;&lt;br /&gt;
&lt;tt&gt;&lt;br /&gt;&lt;/tt&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://irregular-logic.blogspot.com/feeds/5450702455113842601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3273900571922875014/5450702455113842601' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3273900571922875014/posts/default/5450702455113842601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3273900571922875014/posts/default/5450702455113842601'/><link rel='alternate' type='text/html' href='http://irregular-logic.blogspot.com/2011/09/freefilesync-wake-on-lan-for-nas.html' title='FreeFileSync - Wake On LAN for NAS (Buffalo LinkStation™ Duo)'/><author><name>≠ logic - Clemens</name><uri>http://www.blogger.com/profile/16080200567497209790</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6OcGF6WGSGqqUOW081VcXI1wERR6EZKvXFLPKHYzZPkIZNgzvYTh_Bl3KTw_Sa_1RZxZxJt45H-GYW9eRJTuG2HM4pqrbrKT7lDLaS6-owI726RAIyYJmVxC9E4HvE4zmQ0ZOW9NAUVg/s72-c/TaskScheduler.png" height="72" width="72"/><thr:total>2</thr:total></entry></feed>