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 2,867 other followers

Archive for the ‘Mac’ Category

Need to revisit osquery: SQL powered operating system instrumentation, monitoring, and analytics supports more platforms and also aggregates to central log locations

Posted by jpluimers on 2022/01/18

Almost two years ago, GitHub ‚Äď facebook/osquery: SQL powered operating system instrumentation, monitoring, and analytics published from the automatic blog queue.

It was in the midst of my rectum cancer treatment, so I was glad the blog queue back then was still about 18 months deep.

This meant I looked into osquery in 2018, which I remember because I needed it on MacOS as I did not want to remember the syntax for MacOS specific commands on getting system information. It also coincides with how much my repository fork was behind: [Wayback: jpluimers/osquery commits/Archive: jpluimers/osquery commits].

Fast forward to now, the breath of systems I’m involved with has widened, so I was glad to see that Kristian K√∂hntopp mentioned it:

So time to try it again (:

The links he mentioned:

  • [Wayback/Archive] Welcome to osquery – osquery

    osquery is an operating system instrumentation framework for Windows, OS X (macOS), Linux, and FreeBSD. The tools make low-level operating system analytics and monitoring both performant and intuitive.

  • [Wayback/Archive] Welcome to osquery – osquery: High Level Features
    The high-performance and low-footprint distributed host monitoring daemon,¬†osqueryd, allows you to schedule queries to be executed across your entire infrastructure. The daemon takes care of aggregating the query results over time and generates logs which indicate state changes in your infrastructure. You can use this to maintain insight into the security, performance, configuration, and state of your entire infrastructure.¬†osqueryd‘s logging can integrate into your internal log aggregation pipeline, regardless of your technology stack, via a robust plugin architecture.
    The interactive query console, osqueryi, gives you a SQL interface to try out new queries and explore your operating system. With the power of a complete SQL language and dozens of useful tables built-in, osqueryi is an invaluable tool when performing incident response, diagnosing a systems operations problem, troubleshooting a performance issue, etc.
  • [Wayback/Archive] osqueryd (daemon) – osquery
  • [Wayback/Archive] osqueryi (shell) – osquery
  • [Wayback/Archive] Aggregating Logs – osquery
  • [Wayback/Archive] AWS Logging – osquery

Main site: [Wayback/Archive] osquery | Easily ask questions about your Linux, Windows, and macOS infrastructure

Repository: [Wayback/Archive] osquery/osquery: SQL powered operating system instrumentation, monitoring, and analytics.

–jeroen

Posted in *nix, *nix-tools, Apple, Development, DevOps, Facebook, Infrastructure, Mac, Mac OS X / OS X / MacOS, Power User, SocialMedia, Software Development, Windows | Leave a Comment »

Getting the primary IP address (plain and CIDR) on Linux and OS X, then nmap scan on the associated subnet

Posted by jpluimers on 2021/12/13

The below answer works on my Linux and OS X systems (each having multiple network adapters configured):

[WayBack] bash – How to get the primary IP address of the local machine on Linux and OS X? – Stack Overflow

ip route get 1 | awk '{print $NF;exit}'

For Linux, I have this bash function:

# note the ";exit" lists the first default route interface, as there can be multiple
function nmap-fingerprint_network_of_default_interface() {
        default_if=$(ip route list | awk '/^default/ {print $5;exit}')
        default_if_cidr=$(ip -o -f inet addr show $default_if | awk '{print $4}')
        nmap -sP $default_if_cidr
}

And for OS X this one:

# requires ipcalc
function nmap-fingerprint_network_of_default_interface() {
        default_if=$(route -q -n get default | awk '/interface:/ {print $2;exit}')
        default_if_address=$(ifconfig $default_if | awk '/inet / {print $2;exit}')
        default_if_netmask_hex=$(ifconfig $default_if | awk '/inet / {print $4;exit}')
        default_if_network_bit_count=$(ipcalc --nocolor --class $default_if_address $default_if_netmask_hex)
        default_if_cidr=$(echo "$default_if_address/$default_if_network_bit_count")
        nmap -sP $default_if_cidr
}

These are the variables used:

  • default_if: network interface of the default route
  • default_if_cidr: IPv4 CIDR of the network interface of the default route (see Classless Inter-Domain Routing: CIDR notation – Wikipedia)
  • default_if_address: IPv4 address of network interface of the default route
  • default_if_netmask_hex: hexadecimal IPv4 network mask of network interface of the default route
  • default_if_network_bit_count: number of set bits in the IPv4 network mask of the network interface of the default route

Links used to get the above functions:

I might have gotten away with a pure bash solution (see [WayBack] Bash script for calculating network and broadcast addresses from ip and netmask or CIDR Notation · GitHub or my post Getting your local IPv4 addresses, netmasks and CIDRs), but the above works and is way shorter, and easier to maintain.

In stead of ipcalc, subnetcalc can do the same calculations and also supports IPv6, so that is something for a future try:

–jeroen

Posted in *nix, *nix-tools, Apple, bash, Color (software development), Development, Mac, Mac OS X / OS X / MacOS, Power User, Scripting, Software Development | Leave a Comment »

2 x Speakers surround replacement – Designed for Apple G4 Cube M7963 | eBay

Posted by jpluimers on 2021/05/24

For my link archive: [Wayback/Archive.is] 2 x Speakers surround replacement – Designed for Apple G4 Cube M7963 | eBay

2 x Speakers surround replacement - Designed for Apple G4 Cube M7963

Via: [Archive.is] Power Macintosh G4 Cube Owners Group : Hi Guys. Just for you to be aware, this is my product, specifically designed and produced by me to repair the Apple G4 Cube speakers | Facebook

–jeroen

Posted in Apple, Mac, Power Mac, Power Mac G4 Cube, Power User | Leave a Comment »

MacOS: when “Command-Tab” does not work (no visual response, no application switching) you need to restart the Dock

Posted by jpluimers on 2021/05/21

Based on [WayBack] Command-Tab Not working….. РApple Community

If you go to Activity monitor and search for dock, doubleclick on it, choose Force quit.
It will restart the Dock app and now it should work.

I wrote this alias which restarts Dock (including Dashboard and Spaces as they are served by the same process).

alias restart-dock-dashboard-spaces='killall -KILL Dock'

Related: my 2013 post Mac: Restarting the Mac OS X Dock, Finder, Spaces or Menubar | Stefan Ernst.

–jeroen

Posted in Apple, iMac, Mac, Mac OS X / OS X / MacOS, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, macOS 10.12 Sierra, macOS 10.13 High Sierra, OS X 10.10 Yosemite, Power User | Leave a Comment »

Copy files on Mac OS X using drag-and-drop | alvinalexander.com: secret is to hold the Option key

Posted by jpluimers on 2020/12/14

The Finder pure keyboard way of file copy+paste is using CommandC at the source position followed by CtrlCommandV in the destination position (in the destination position,  CommandV will do only a cut+paste) as the paste/copy decision is determined in the final stage.

This is unlike Windows, where CtrlC means copy, CtrlX means cut, and CtrlV finishes the initial action to copy+paste or cut+paste. 

If you combine mouse dragging, on the Mac it becomes Optiondrag, whereas on Windows it still is Ctrldrag.

I think the Windows ones are more consistent, especially when looking at them in table form:

Action Windows Mac
Keyboard-Only Mouse-drag Keyboard-Only Mouse-drag
copy+paste CtrlC; CtrlV Ctrldrag CommandC; Ctrl+CommandV Optiondrag
cut+paste (or move) CtrlX; CtrlV drag CommandC; CommandV drag

(table with help of HTML Table generator РTablesGenerator.com)

Mac shortcuts via:

–jeroen

Posted in Apple, Mac, Mac OS X / OS X / MacOS, Power User, Windows | Leave a Comment »

 
%d bloggers like this: