in browser mark #:~:text=Domain

I've come acros
#:~:text:<text to be marked here>

try it yourself here:
https://example.com/#:~:text=Domain

which seems to be a nice chrome feature.
unfortunately it doesn't work in every browser (yet)

Problem: Consensus & Standardization

https://chromestatus.com/feature/4733392803332096
After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

Firefox: Negative
Edge: Positive
Safari: Neutral
Web Developers: Positive

New Computer Q1 2021

I've been thinking about new computer lately.

after some thinking I've made up my mind, that it won't really benefit me.

But since I already did some deeper research I wanted to share my gained knowledge.

hardware and my thoughts on it

cpu

Core I9-10850K, Socket LS1200

  • amd or intel
    well I prefer intel, but lets consider plain workpower
    I9 10900k vs ryzen
    >> see the benchmarks yourself
  • Why not I9-10900K?
    I9-10850K or I9-10900K ..
    seems the 10850k has almost the same performance (-1%)
    with even a little less power consumption
    both are fine... whatever you get.. price is almost the same
    >> see benchmarks or here
  • so there is a I9 10850K avenger edition, whats that?
    just a fancy special edition.. a true fan might want to buy it
  • box or retail? whats the difference?
    box has a cpu with fan, retail is the plain cpu
  • intel I9 LS1200 vs LS2000
    i9x price of cpu 1000-4000 EUR, which is ridiculous
    why? well more than 10 cpu cores, which give you higher compute power
  • Socket 1200 for pentium I7, I9,...
  • cooling? water? air?
    water cooled is definitly more silent and looks awesome
    price is higher too
    air cooled is established, works fine. needs less space. just get a big silent fan

cpu fan/cooler

Noctua NH-D15

  • I have a this one on my I7, its silent and works great
  • necessary conntector/socket, for cpu cooler?
    look for "1200" in compatibility describtion

mainboard

ASUS PRIME Z490-A
-A not -P, there is a difference in performance
alternatives: MSI MEG Z490 ACE, Gigabyte Z490 Aorus Ultra

memory ram

G.Skill Trident Z Neo DIMM Kit 32GB, DDR4-3600, CL16-19-19-39 (F4-3600C16D-32GTZNC)

  • Clockspeed, as higher as better!
    is it? well not exactly, there is no real better performance between 3000 and 4400
    see benchmark
    so 3000 is fine

tower

be quiet! 600, 601, 700 or Nanoxia Deep Silence 3

  • size: midi
    compare height of your current
  • noise & cooling?
    benchmark of noise and heat
    airflow performance
  • does it look good TO ME? thats subjective
  • does this matter? well.. in the beginning for myself. but it's always nice to show what fancy hardware you have to someone else
  • is it worth additional price?
    600 vs 700: 700 has a usbc and looks better for +50/+100 EUR, which is 50-100% more
  • how many disks do I want to be built in?
  • side glas or no glas?
    well I don't want to show off, so a optimized silenced sidewall is good for me

power supply

650 Watt be quiet! STRAIGHT POWER 11 Platinum 80+

price

last checked at 02.02.2021

~ 1000 €
no graphics card included

where I check for cheapest prices

shops where I usually buy

if its that awesome - why did I not buy it?

As mentioned in the beginning.. it would not benefit me that much.

My system is a HP z620 and has

  • 2x Intel Xeon E508 (8 cores 16 threads, => 2x so 16 cores 32 threads)
  • 96 GB DDR3 Memory
  • 1 GB SSD on PCIe-X (3000 mb write, 2400 mb read)
  • a few 8 TB HDDs for storage
  • 10 G ethernet

so.. the only real downsides for me are

  • power consumption: 800 W instead of 600 W
  • no USB 3.2/3.1
  • newer Intel specific CPU commands

I hope it helps you a bit finding your pc setup

vscode python – No module named ‘src’

I've had some issues with running python code in vscode.

I have a project folder.
The code is in the "src" folder running a file one level below

the error

my terminal always said:

    from src.mymodule import *
ModuleNotFoundError: No module named 'src'

The solution

ctrl + p

Preferences: Open Settings (JSON)

append

"terminal.integrated.env.linux": {
    "PYTHONPATH": "${workspaceFolder}/src:${env:PYTHONPATH}"
  },
  "terminal.integrated.env.osx": {
    "PYTHONPATH": "${workspaceFolder}/src:${env:PYTHONPATH}"
  },
  "terminal.integrated.env.windows": {
    "PYTHONPATH": "${workspaceFolder}/src;${env:PYTHONPATH}"
  },

One last step:

close the terminal running it
press on run code again

The issue is discussed here:

https://github.com/microsoft/vscode-python/issues/11875

CyberChef – a web app for encryption, encoding, compression and data analysis

I've just noticed, I did't talk about tools which I use quite often, for several data conversion purposes.

CyberChef

https://github.com/gchq/CyberChef

The Cyber Swiss Army Knife
CyberChef is a simple, intuitive web app for carrying out all manner of cyber operations within a web browser. These operations include simple encoding like XOR or Base64, more complex encryption like AES, DES and Blowfish, creating binary and hexdumps, compression and decompression of data, calculating hashes and checksums, IPv6 and X.509 parsing, changing character encodings, and much more.

The tool is designed to enable both technical and non-technical analysts to manipulate data in complex ways without having to deal with complex tools or algorithms. It was conceived, designed, built and incrementally improved by an analyst in their 10% innovation time over several years.

Thats what they say, and thats what it is.


It was developed by gchq (https://www.gchq.gov.uk/), which is the british inteligence agency. They have a few interesting tools made available on their github (https://github.com/gchq)

Useful Operations

  • From/To Hex
  • From/To Base64
  • URL Encode/Decode
  • Regular Expression
  • XOR Brute Force
  • Decode Text
  • CSV to JSON
  • JSON to CSV
  • RC2, RC4, DES, Triple, DES, AES Encrypt/Decrypt
  • Bitwise operations
  • HTTP request
  • JPath Expression
  • Strings
  • Extract Filepaths
  • Extract EXIF
  • Zip/Unzip
  • Tar/Untar
  • All the Hashes
  • Syntax Highlighting
  • Script Beautify
  • Render Image
  • ...

Examples

Magic

The "Magic" feature:
It automatically tries different things and mostly time gets a result.

AES Decryption

Base64 decode

Regular Expressions

This is something I often use to extract text/data or to put the data into the right format. (" => ', "..", => {data: ".."} )

If it doesn't work, you still can go to https://regex101.com/ to figure out why your Expression is wrong

How to use it

Well.. I don't like giving information away or online, if I don't have to..

I actually downloaded it and use it offline. It works just fine, I didn't see any difference.

from local: file:///S:/Portable/CyberChef_v9.21.0/CyberChef_v9.21.0.html

For several operations you might want to turn Auto Bake off
it calculates automatically on any change you do, which can slow down your process sometimes.


Further Readings

Recipes and Links to resources

https://github.com/mattnotmax/cyberchef-recipes/edit/master/README.md

  • Recipe 1: Extract base64, raw inflate & beautify
  • Recipe 2: Invoke Obfuscation
  • Recipe 3: From CharCode
  • Recipe 4: Group Policy Preference Password Decryption
  • Recipe 5: Using Loops and Labels
  • Recipe 6: Google ei Timestamps
  • Recipe 7: Multi-stage COM scriptlet to x86 assembly
  • Recipe 8: Extract hexadecimal, convert to hexdump for embedded PE file
  • Recipe 9: Reverse strings, character substitution, from base64
  • Recipe 10: Extract object from Squid proxy cache
  • Recipe 11: Extract GPS Coordinates to Google Maps URLs
  • Recipe 12: Big Number Processing
  • Recipe 13: Parsing DNS PTR records with Registers
  • Recipe 14: Decoding POSHC2 executables
  • Recipe 15: Parsing $MFT $SI Timestamps
  • Recipe 16: Decoding PHP gzinflate and base64 webshells
  • Recipe 17: Extracting shellcode from a Powershell Meterpreter Reverse TCP Script
  • Recipe 18: Recycle Bin Parser with Subsections and Merges
  • Recipe 19: Identify Obfuscated Base64 with Regular Expression Highlighting
  • Recipe 20: Using Yara rules with deobfuscated malicious scripts
  • Recipe 21: Inline deobfuscation of hex encoded VBE script attached to a malicious LNK file
  • Recipe 22: JA3 API search with HTTP Request and Registers
  • Recipe 23: Defeating DOSfuscation embedded in a malicious DOC file with Regular Expression capture groups
  • Recipe 24: Picking a random letter from a six-byte string
  • Recipe 25: Creating a Wifi QR code
  • Recipe 26: Extracting and Decoding a Multistage PHP Webshell
  • Recipe 27: Decoding an Auto Visitor PHP script
  • Recipe 28: De-obfuscation of Cobalt Strike Beacon using Conditional Jumps to obtain shellcode
  • Recipe 29: Log File Timestamp Manipulation with Subsections and Registers
  • Recipe 30: CharCode obfuscated PowerShell Loader for a Cobalt Strike beacon

Here is an interesting Presentation from

Jonathan Glass: How CyberChef is used for CyberSecurity

https://www.osdfcon.org/presentations/2019/Jonathan-Glass_Cybersecurity-Zero-to-Hero-With-CyberChef.pdf

Markdown editors

I have searched and tested several editors during these days, and I was able to narrow down the selection to my needs. Typora and Mark Text.

tl;dr

Typora is beautiful, easy and just works. currently at Version 0.99.32.1 free, when 1.0 is here, you need to buy a license.

Mark Text is beautiful, easy, has a better support for mermaid and IS FREE.
the only downside for me: on my ubuntu it has a slight lag.

Typora - typora.io | github

Markdown WYSIWYG

MD Code Editor

MarkText - marktext.app | github

Editor view

Source Code View

cloud encryption: cryptomator

Here is a great solution for anyone who wants to encrypt their data before putting it onto the cloud.

https://cryptomator.org/

It's an open-source encryption software for PC, MAC, Linux, Android, and iOS. So every common plattform is supported.

How is it encrypted?

In short:
You get a realtime de-/encrypted container.

the password: scrypt
the files: AES-GCM (256 Bit)
(the filenames are also encrypted beforehand)

See the full documentation on that here: https://docs.cryptomator.org/en/latest/security/architecture/

pc windows example

Note

There are multiple files generated. good for cloud sync.
The structure looks for similar to the files and folders created with ENC DataVault by ENC Security
You get a "light" Version (which enables AES 256 bit) of that software with buying a Sandisk Cruzer USB Stick. I've bought the pro version allowing multiple, military-grade AES 512 and also AES 1024 bit containers.
=> cryptomator has a better usability

Use cases

In my case, I use it to safely share and access data between my windows pc, linux (ubuntu) and android smartphone.

On mobile, you get the option to sync your taken pictures encrypted into one container. for convenience, there is the option of entering your credentials to encrypted containers via fingerprint.

It would be possible to share cloud storage with other family members and keep private data protected.

You could also just encrypt your files locally on an external disk.

About the company: Skymatic GmbH

It's born as a german startup with the idea: there are a few cloud encryption tools available... but no one has made their code open source to be transparent and also more secure.

They also provide company licenses for implementing their technology into your own software or you can get an enterprise solution for encrypted file storing and sharing: cryptomator server https://server.cryptomator.org/

Pricing

Nov 2019:
PC / Linux / Mac: Pay what you want

0 EUR, 9 EUR, 15 EUR, 25 EUR or what you want

Android and iOS:

iOS 5,99 EUR - 4,99 USD
Android 9,99 EUR
right now there is a discount for 5,99 EUR

Secure E-Mail with Gpg4win

On the 07.05.2019 the BSI (Federal Office for Information Security) has released a press article that federal institutions may use Gpg4win ( https://www.gpg4win.de/ ) to send VS-NfD / restricted data via mail.
which means for us..
-> if it's safe for restricted federal data...
-> it's safe to use for everyone's emails as well 🙂

https://www.bsi.bund.de/DE/Presse/Pressemitteilungen/Presse2019/Gpg4win-mit-VS-NfD-070519.html

A note on why you should encrypt and what the software does, can be found here

https://www.bsi.bund.de/DE/Themen/Kryptografie_Kryptotechnologie/Kryptotechnologie/Gpg4win/gpg4win_node.html

Basically.. if you send private messages... in the realworld, you wouldn't want to send several things readable to everyone on the way either, like on a postcard.

=> On the web.. sending emails is like sending postcards...

Of course, TLS/SSL helps that the way your message is transferred safely.. but on the servers, your emails are still readable in clear text.
Oh.. wait.. there is the patriot act, which allows national agencies to access to those on demand. but not only the USA has such laws..

The thing is, that federal security agencies like the NSA might copy your emails and make profiles from it.
Even your metadata 😉 speaks a lot about you
who you are friend with.. what topics you talk to them.. when you are awake, if you are in vacations, from which location/computer you send your email from... and many more

The goal here is: END to END
private/public key encryption (RSA)

How does RSA work?

You can encrypt with a public key but only decrypt with a private key.
https://www.tutorialspoint.com/cryptography/public_key_encryption.htm

You generate a password-protected private key, which you don't share.
With this one, you generate a public key.

Now you send your public key to the other person.
The other person encrypts the message with your public key and sends it to you.
You can decrypt the message with your private key.

I'll make a tutorial on how actually to use Gpg4win

Write Clean Javascript Code

A awesome resouce on writing clean javascript code
https://github.com/ryanmcdermott/clean-code-javascript

based on Robert C. Martin's book
Clean Code: A Handbook of Agile Software Craftsmanship

"The only valid measurement of code quality is WTFs/minute"

Variables

  • Use meaningful and pronounceable variable names
  • Use the same vocabulary for the same type of variable
  • Use searchable names
  • Use explanatory variables
  • Avoid Mental Mapping
  • Don't add unneeded context
  • Use default arguments instead of short circuiting or conditionals

Functions

  • Function arguments (2 or fewer ideally)
  • Functions should do one thing
  • Function names should say what they do
  • Functions should only be one level of abstraction
  • Remove duplicate code
  • Set default objects with Object.assign
  • Don't use flags as function parameters
  • Avoid Side Effects
  • Don't write to global functions
  • Favor functional programming over imperative programming
  • Encapsulate conditionals
  • Avoid negative conditionals
  • Avoid conditionals
  • Avoid type-checking
  • Don't over-optimize
  • Remove dead code

Objects and Data Structures

  • Use getters and setters
  • Make objects have private members

Classes

  • Prefer ES2015/ES6 classes over ES5 plain functions
  • Use method chaining
  • Prefer composition over inheritance

SOLID

  • Single Responsibility Principle (SRP)
  • Open/Closed Principle (OCP)
  • Liskov Substitution Principle (LSP)
  • Interface Segregation Principle (ISP)
  • Dependency Inversion Principle (DIP)

Testing

  • Single concept per test

Concurrency

  • Use Promises, not callbacks
  • Async/Await are even cleaner than Promises

Error Handling

  • Don't ignore caught errors
  • Don't ignore rejected promises

Formatting

  • Use consistent capitalization
  • Function callers and callees should be close

Comments

  • Only comment things that have business logic complexity.
  • Don't leave commented out code in your codebase
  • Don't have journal comments
  • Avoid positional markers