The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,861 other subscribers

Archive for the ‘Network-and-equipment’ Category

SMS sending with Mikrotik RouterOS and a capabable USB device

Posted by jpluimers on 2017/07/27

Some links that were useful getting the SMS sending stuff to work.

The documentation is clear on what to do to send/receive SMS:

But it is unclear what USB hardware does work, so here are some links:

You can also do it the other way around:

–jeroen

Posted in Development, Internet, MikroTik, Power User, RouterOS, routers, Scripting, Software Development | Leave a Comment »

Increasing the WinBox font size on OS X

Posted by jpluimers on 2017/07/26

Though the Mikrotik people seem reluctant to make the font size in Winbox configurable, if you run it through WineBottler on OS X, you can scale the individual app. It’s not very pretty but makes it easier to use.

The trick is based on the Windows DPI font settings explained for instance at DPI Display Size Settings – Change – Windows 7 Help Forums and Large Fonts in Registry: Where Exactly? | PC Review but then in Wine.

For Windows, this is a system wide setting, but on a WineBottler application there is one “Windows environment” per application, so it’s application specific and should work for other applications than WinBox as well.

It makes it much easier to do script editing now.

Steps I performed:

  1. Quit all WinBox instances
  2. Open a Terminal
  3. Open this file /Applications/Winbox4Mac.app/Contents/Resources/system.reg
  4. Find this key and name=value:
    • key
      • [System\\CurrentControlSet\\Hardware Profiles\\Current\\Software\\Fonts] 1460991918
    • name=value
      • "LogPixels"=dword:00000060
  5. Change the name=value to be like this (scales to 133.3333333%)
    • "LogPixels"=dword:00000080
  6. Save the file
  7. Start WinBox

The value increases the DPI from 0x60 (96 DPI) to 0x80 (128 DPI) , but the WinBox software isn’t smart enough to scale a lot of other UI properties based on it (like controls dialogs, grid cell sizes and script editors).

So it takes a bit of experimenting what works well (on my system, dword:00000090 – or 144 DPI) which scales to 150% cuts off too much of the descenders).

Values I tried:

  • dword:00000060
  • dword:00000078
  • dword:00000080
  • dword:00000084
  • dword:00000090

I got at this trick through [Wine] Screen font size then wading my way to find where system.reg was stored on my system.

TODO: dive into Fixing Windows font scaling without restarting | Marc Durdin’s Blog and see if other registry settings need to be applied as well.

–jeroen

Posted in Development, Internet, MikroTik, Power User, RouterOS, routers, Scripting, Software Development | Leave a Comment »

The strange case of some applications not being able to copy/paste on the Mac OS X clipboard

Posted by jpluimers on 2017/07/19

I’ve not tracked down the cause yet, but these seem to be related:

  1. The Mac OS X build of Atom IO
  2. WinBox v 3.4 WineBottle version from Winbox for Mac in an embedded Wine environment – Joshaven.com
  3. pbcopy / pbpaste that allow command-line copy/pasting
  4. none of these being able to copy/paste any more and return error level 1 like terminal – pbcopy exits code 1, no error message – Ask Different but not even running tmux or screen which means this solution does not apply: ChrisJohnsen/tmux-MacOSX-pasteboard: Notes and workarounds for accessing the Mac OS X pasteboard in tmux sessions.
  5. I didn’t have Mouse Keys turned on
  6. Other applications (Chrome, FireFox, TextEdit, Finder, etc) still being able to copy/paste between each other

I’ve “fixed” 4. by doing this as recommended at osx – Copy and Cut sometimes don’t work – Ask Different:

launchctl list | grep com.apple.pboard

If the pboard daemon is running, then stop and start it. If it’s not running, start it:

launchctl stop com.apple.pboard
launchctl start com.apple.pboard

Now 4. works again if I restart each application, 6. still works, but these applications still cannot copy/paste to 1. 2. and 3.

What does work is a full reboot, but that takes a while (especially Chrome re-loading lots of Windows: I need to get more organised here).

It might be that I need to restart each application in 6.

Grrr…..

–jeroen

Posted in *nix, *nix-tools, Apple, atom editor, Hardware, iMac, Internet, Mac, Mac OS X / OS X / MacOS, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MikroTik, Network-and-equipment, OS X 10.10 Yosemite, OS X 10.11 El Capitan, OS X 10.9 Mavericks, Power User, routers, Text Editors, tmux | 4 Comments »

Mikrotik RouterOS scripting: for loops are a bit of getting used to

Posted by jpluimers on 2017/07/18

Earlier, I wrote “:for loops are a strange beast so I will elaborate on those in a separate post.” so now is the time to do that.

The :for loop documentation is very dense:

Command Syntax Description
for :for <var> from=<int> to=<int> step=<int> do={ <commands> } execute commands over a given number of iterations

So a for loop has these elements:

  • from=
  • to=
  • step=
  • do=

Luckily, the old RouterOS 2.7 documentation on loops (which they’ve revamped after Router OS 2.7 removing many useful examples) has this:

:for – It has one unnamed argument, the name of the loop variable. from argument is the starting value for the loop counter, tovalue is the final value. This command counts loop variable up or down starting at from and ending with to, inclusive, and for each value it executes the do statement. It is possible to change the increment from the default 1 (or -1), by specifying the stepargument.

[admin@MikroTik] > :for i from=1 to=100 step=37  do={:put ($i . " - " . 1000/$i)}
1 - 1000
38 - 26
75 - 13
[admin@MikroTik] >

You might think that from= the start value, to= the finish value and the loop won’t execute when step= a positive value and from= larger than to=. Or that without a step= the loop will always iterate in ascending order.

Wrong! And wrong!

So it’s time for some…

:for loop examples

Read the rest of this entry »

Posted in Development, Internet, MikroTik, Power User, RouterOS, routers, Scripting, Software Development | Leave a Comment »

TomatoUSB – selectively save/restore NVRAM settings before/after upgrading

Posted by jpluimers on 2017/07/14

TomatoUSB recommends a NVRAM reset (or 30/30/30 reset) before and after upgrades.

This means you loose all your settings which causes a lot of people to not upgrade at all.

The steps to export/import are a bit vague as they depend on what you want to save.

It basically comes down to do this on the old configuration

nvram export --set

Save that output to a local file and then use a search tool searching for specific sections you want to restore.

After you restored the sections ensure you persist them:

nvram commit

This is what the TomatoUSB author usually searches for:

Read the rest of this entry »

Posted in Internet, Power User, routers, TomatoUSB | Leave a Comment »

3.6 GIG – Public-Mikrotik-Bandwidth-Test-Server – MikroTik RouterOS

Posted by jpluimers on 2017/07/10

Don’t abuse: 3.6 GIG – Public-Mikrotik-Bandwidth-Test-Server – MikroTik RouterOS [WayBack]

Primary btest server (for short high speed bursts):

  • IP address: 207.32.195.2
  • User: btest
  • Passowrd: btest
  • Max connection time: 10 minutes
  • No winbox access, only bandwidth test

Secondary btest server (for longer less high speed traffic) [WayBack]:

  • IP address: 207.32.195.10
  • User: btest
  • Passowrd: btest
  • Local Tx Speed: 25k
  • Remote Tx Speed: 25k
  • No winbox access, only bandwidth test

–jeroen

Posted in Internet, MikroTik, Power User, routers | 6 Comments »

Mikrotik RouterOS /ip firewall address-list timeout values sort-of documented

Posted by jpluimers on 2017/07/05

Thanks to ZeroByte answering at [Answered] Where are ip firewall address-list timeout values documented – MikroTik RouterOS [WayBack] which I edited a bit here:

I haven’t seen anything specific to the format of these time tokens, but the firewall add-to-address-list timeout is documented here:
http://wiki.mikrotik.com/wiki/Manual:IP … Properties…It seems to take the same format as any other similar duration-related input I’ve encountered:
  • a raw number is interpreted as seconds
You can specify a number as another duration with tokens:
  • s = seconds (default)
  • m = minutes
  • h = hours
  • d = days
  • w = weeks

A few aspects:

  • Tokens can combine be in any order
  • Whitespace is ignored

So these are all valid:

2s 2h 2w
1w2d3h4m5s
5s4m3h2d1w

  • Days and weeks just get added together. If you specify 1w8d, this is the same as 2w1d
  • The last value specified may be in h:m:s format or in h:m (omit seconds)
  • Interestingly, if you mix and match, they just get added:
    • “1d 2h 12:30” -> “1d 14:30:00”
  • Values larger than 536870911 seconds are stored and tracked but when displayed show as 0sec.
    (248 days, 13:13:55)
  • The maximum value is 4294967295 seconds (which is the maximum 32-bit value)
    This decodes to: 7101w3d6h28m15s as the largest value….
    (7101 weeks is ~136 years counting for leap years, by the way)

–jeroen

Posted in Development, Internet, MikroTik, Power User, RouterOS, routers, Scripting, Software Development | Leave a Comment »

Tunneling over WebSockets

Posted by jpluimers on 2017/07/04

Just found out about these interesting links I had loved to use years ago, but alas, now I know (:

It looks similar to SSL VPN sometimes also called WebVPN:

Then there are non-VPN tunnels through WebSockets:

Since WebSockets can run over a proxy server you could route any kind of binary traffic through them even in places that disallow non-web protocols or layer-7 inspect https traffic.

Although ops might restrict stuff even further:

–jeroen

Posted in Internet, Network-and-equipment, Power User, VPN | Leave a Comment »

middelink/mikrotik-fwban: Use your Mikrotik firewall to do fail2ban like blocking of unwanted IPs. Written in Go

Posted by jpluimers on 2017/06/26

Interesting: middelink/mikrotik-fwban: Use your Mikrotik firewall to do fail2ban like blocking of unwanted IPs. Written in Go.

It might beat these (that just count SSH connections, not failed connection attempts):

Another alternative is to parse one of the logs:

Of course you should have this installed by default as part of your hardening process:

–jeroen

Posted in Development, Internet, MikroTik, Power User, RouterOS, routers, Scripting, Software Development | Leave a Comment »

How to turn on your lights the Philips way

Posted by jpluimers on 2017/06/23

This was too funny to let go unnoticed: [WayBack] How to turn on the light at home, Philips Version – Kristian Köhntopp – Google+.

It was shown during [Archive.isGoogle Cloud Next 2017 in Amsterdam and immediately reminded me of The Big Bang Theory – How to turn on a lamp below.

A few notable entries from the comments:

  • Wie viele Server braucht man bei Philips, um eine Glühbirne zu wechseln?
  • Apple macht das wohl ähnlich, hier dient ein AppleTV oder ein iPad als “Bridge zur Bridge”.
  • They’re at least honest — the icon of the cloud in the upper left prominently displays a “waiting” circle animation. I also notice the use of the word “looks” rather than “works” in the title, which is probably also accurate.

–jeroen

Read the rest of this entry »

Posted in Cloud, Fun, Infrastructure, IoT Internet of Things, Network-and-equipment, Power User | Leave a Comment »