SQLite crash-course

Backstory for this thread is I have a project where I want to review SQLite data.  SQLite is more a less, a compressed database in a flat-file.   Usage tends to be for storing application data, especially in the case of mobile apps.  In my case I wish to query quite a bit and to do so across multiple databases.  As I have the most database experience in MsSQL, I am exporting data from SQLite so I can place it into a MsSQL Database for better querying and results.

There are a few GUI tools for reviewing SQLite databases but if you want to collect data from them outside of their native application, this is where and why I am exporting and importing the data into Microsoft SQL Server.   You could do the same with MySQL and your usage would be slightly different (in the case of using ` instead of ‘ [single quote]).  So pick the database platform you are the most comfortable with or like more.

Task 01:
Reading the SQLite Database.
You can open up the .sqlite in a text editor but as I noted it being compressed, your results will essentially be gibberish characters.  While there are some plaintext values, we want the actual raw data set.  This will look like your standard database dump / csv / tables view.

Task 02:
Running SQLite.
Let’s grab a download of the SQLite binary.  Pick your OS of choice.  In my case I am a Windows main user so I grabbed the sqlite-tools-win32-x86-3270100 windows binary and extracted it to a target folder.   Once extracted we will see sqlite3.exe.  Get used to running this, as this will get us into the SQLite console.

Task 03:
Reading the SQLite database(s).
Starting off, let’s grab a copy of the .sqlite file you want to read and paste a copy into your extracted SQLite tools folder.  I tried full path loading to my sqlite data file but it was giving me issues.  Instead of fighting with that, I just pasted a copy into the same folder as sqlite3.exe we will be running. This is a helpful document on the SQLite website for querying as well.

Once your .sqlite file is in the same folder, bring up a command prompt (cmd.exe) into that folder.  I recently learned a nice trick about getting a cmd prompt into a current folder in explorer.  Browse to said folder and in the address bar, replace the filepath with ‘cmd.exe’ (without quotes) and you will get a command prompt into that folder.  Saving you from changing your drive letter and folder path in the command prompt.

In this cmd window, start by running sqlite3.exe.  By doing so your console will change to sqlite> as you are now running sqlite.  .help will give you all the available options.  Below I will give you a cheat guide in the case of how to: Load a database, select a table, set your export mode and to export the table contents to a flat file! Yeet

.open 'SQLite_DB_in_folder.sqlite' 
.tables
.mode csv
.header on
.output filename.csv
select * from table;
.quit

– For the above console / code example, we start by opening the .sqlite database file.
– List the tables in said database.
– Set our export mode to CSV.
– Export with header / column names as first row.
– Output results of next line query to target flat-file.
– Enter the query with desired table from listed .tables results (You can review these in console by just typing select statement in console, before you enter the .output line).
– .quit exits sqlite3.exe console.  I suggest exiting after an export or your output file will remain in use by the sqlite3.exe console connection.

Step 04:
Review your output then import to MsSQL, etc.
Open up your output .csv files and they should look like plaintext output.  With that being the case you should be able to import them into the relational database system of your choice and go wild querying away!
I should end noting you can also query from the SQLite console too, but since I am looking to compare a large amount of data from various databases, I will import these exported tables into one database on MsSQL with different tables for each.

Note: Your exported .csv will NOT have column labels (unless you follow revised guide).  I edited this post and added ‘.header on’ into the commands so our output would have the column names as first row of the .csv export.

Thanks for reading and have fun heccing all the things!

Back content

I’m adding some other content I wrote up in the second half of 2018. Sometimes I forget I turned off the RSS import. :)
FYI content here on BlissPC tends to be threads on the FTB Forums from this subforum.

Powershell Log collection

I have been doing a bit of PowerShell to configure and interact with various Windows versions.  I built up some core scripts to use as my own kind of workshop for system review and administration.  I wanted to drop an example script to chat about.

One of the things I struggled to understand starting out was string substitution and being able to define a variable that would also consistently output to a file path of my choosing.  TL;DR on that resolution is to wrap the other variable you are calling (example: file paths) in a $() block.  As seen below, I call my Computername environmental variable so it can be used in the output of file names and logs.

# getEventLogs: Maintenance collection script. 
$boxName = $env:COMPUTERNAME
$outEvt01 = ".\$($boxName)_EventLog_Apps.csv"
$outEvt02 = ".\$($boxName)_EventLog_System.csv"
$outSvc01 = ".\$($boxName)_Service-RunStates.log"
$outPorts01 = ".\$($boxName)_Network-Ports.log"
$outTask01 = ".\$($boxName)_Tasklist.log"
$outSchTsk01 = ".\$($boxName)_Scheduled-Tasks.log"
Filter timestamp {"Logs collected at $(Get-Date -Format "yyyy-MM-dd HH mm ss")"}

# Application Event Log most recent 100 messages.
Get-EventLog application -newest 100 | Export-Csv $outEvt01
timestamp | Out-File -Append $outEvt01 -Encoding ASCII
Get-EventLog system -newest 100 | Export-Csv $outEvt02
timestamp | Out-File -Append $outEvt02 -Encoding ASCII

# Collect service list and current state of each.
Get-Service | Sort-Object status | Format-Table -AutoSize | Out-File $outSvc01
timestamp | Out-File -Append $outSvc01

# Get process list with relevant details at time of script exec.
cmd /c netstat -aon > $outPorts01
timestamp | Out-File -Append $outPorts01

cmd /c tasklist > $outTask01
timestamp | Out-File -Append $outTask01

Get-ScheduledTask | Select TaskName, State, TaskPath | Sort-Object -Property TaskPath | Format-table -wrap | Out-File $outSchTsk01
timestamp | Out-File -Append $outSchTsk01

# Wrap all these output into update state / append single file. # Stamp date and Time into said merged output.



Starting out at the top, I defining a variable for the powershell equivalent of environmental variables in the OS like %computername%.  Trust me here, you don’t want to try and call a %variable% in a powershell script.  That’s what line 1 is for.

Each of the following defined variables are my output paths for the collections.  I use .csv exports for larger data sets, since the default Table outputs can heavily chop data to fit the terminal output.

Brief OCD DBA note.  Being a fan of Databases and Microsoft SQL, I really value a good | (pipe) to run:

| Select *


after a command.  You can filter that raw output for fields you want to have outputted by writing a custom Select pipe.  There is an example of that for Scheduled Tasks, I just wanted to word out the logic as that took me some time to figure out that is how I can see what my options are for selecting output fields.

The other variables for file path are so I do not have to add the same string twice or more.  As you can see on the actual commands, I add an Out-File -Append to insert the Date string to each file.

Filter timestamp is my means for defining the date output string.  That time will be for when the script is run, so each file will have a matching output time.  Think of filter in this context as an easier Function.

The rest of the script uses either Powershell cmdlets or OS level commands to obtain the data I am looking for and saving to the output files.  I experimented both ways to see what output best matches the task and output I want to work with.

The Export Events logs are pretty simple in calling the 100 most recent events, saving that to a .csv, then adding the Date string at the end of said file.

Service list is sorted and exported to a .log file with the Date string added (as the date will be added for the other 4 output files as well).

‘ cmd /c ‘ calls a windows command but ignores keywords for powershell on that line.  Huge helpful thing to know when trying to process content by use of an OS-level command.  Otherwise you will see really esoteric issues you would rather not have to figure out the secret means of why they are failing.  cmd /c is quite nice.  FYI.

Neat.  We are at the part I rambled above in relation to databases and filtering content.  I did not need many of the details in the raw output from showing all the parameters of that Powershell cmdlet.  Selecting the relevant fields, I then sort based on the TaskPath field (to put the non-OS tasks first in the list), apply a -wrap text for the Format-Table output of that cmdlet, then output the data into a local file.

I have done some scripts with loop and condition evaluations but I will stop here for the moment.  If you want to gather some information about an environment, hopefully this example gets you in the right direction for your data collections.

Let me end with a link to a great resource. SS64 has some good resources and examples.  They have been very helpful in conjunction with the Windows Powershell manuals.

Windows 10 Settings error Apps and Features

Say you are trying to use Settings | System | Apps and Features but you get an error along the lines of “windows cannot access the specified device path or file. you may not have appropriate permissions” trying to uninstall a program.  You can also get a hard error and better search cross reference by clicking Manage optional features when in the Apps and features screen.
This applies to Windows 10 and Server 2016.  In my case I am on Server 2016 Standard Eval Version 1607 OS Build 14393.2273.

Stepping back on the error, you might thing it a permission issue but in my case I was logged in as domain administrator.  Base searching might have you remove and recreate your user profile but that is a waste of time and irrelevant to the issue.  Don’t waste your time messing with the profile.  You can confirm in Control Panel that using that Programs and Features works without error to uninstall programs.

Thanks to clicking the Manage optional features of Apps and features, I got info on the systemsettingsadminflows.exe to better search against my issue.  Thanks to this page, I followed the secpol.msc steps to change a local policy to allow access for ‘Admin approval mode’.
Once I enabled that option and did a log out and back in (shutdown -l), I could use the Apps and features portion of settings without cryptic error.

  • Local Policy
  • Security Options
  • User Account Control: Admin Approval Mode for the Built-in Administrator Account
  • Enable this then logout then back in


Hopefully that helps you avoid the black holes that can be searching for unable to uninstall program in windows with via settings, or similar strings.

Make a VM lab for Active Directory

Ad Build Guide:
Primer:  I see quite a few people talk about wanting to do vulnerability research, yet not having much Windows exposure.   It could be heavy bias on my part but for the roles i have seen, Windows is pretty dominant in the wilds of the business world.  The intent here is to learn more about Windows domain environments by building a test environment of our own to test on.  Disclaimers apply to why we want to make a test environment: I really really really do not want to read about you getting arrested for poking a stick at some Windows environment you found in the wild, without having been granted permission to do so.  It is really minor effort to find a server with Remote desktop protocol port open to the internet.  Granted at this point in time, that should be considered negligence on the part of sites with that port open, but alas, that would not work as a defense for your sake.
I have intended to write this guide with a minimal technical background being required, for the sake of welcoming more people to utilize it.

Now that we got out of the way, let us start with the hardware and software used to build your Virtual Machine lab.
+ A modern desktop or laptop running an x64 processor.  You can be running Windows, Linux or OS X for your desktop operating system, as we are going to use VirtualBox to build the VMs.  The following guidelines can be applied to your Virtualization platform of choice, but I like VirtualBox for sake of cross-OS Virtual Machine migration and price point for running VirtualBox.
+ 16 GB RAM or more is preferable.  You could get by with less but may find your VMs running low for resources and have less options for multiple, concurrent running VMs.
+ A SSD drive.  Running on an SSD will greatly speed up time to copy an existing VM and also improve desktop performance of the VMs.  You can get by on a HDD, but you will wait much longer to clone a virtual disk image and your virtualized desktop OS might be laggy.

Getting started, we want to install VirtualBox, make sure VT-x support is enabled (likely a BIOS setting you can set when your PC is booting up) and to download Windows Server 2016.  We could go with older versions of Windows and poke those with a security stick, but if you are trying to get some viable business experience, I would jump into the more recent OS, particularly as many businesses have been lagging on their migrations from older Windows Server versions.  There is no shame in learning and trying to also be marketable at the same time.

  • VirtualBox:
https://www.virtualbox.org/wiki/Downloads
  • Windows Server 2016


Download the ISO image. https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2016/
This will give you a 180 day trial install.  So long as not doing so on the Domain Controller server with that role active, you can Sysprep the install to reset the timer and OS back to it’s initial state.  More on that further in this guide.

While those download and you install VirtualBox, let’s step back to overview your intent with this test lab.  We are installing an initial Windows Server 2016 virtual machine.  Once that is up, we will clone that image so we have a master control image.  For the sake of this lab, let’s leave the Master image intact then create 4x master clones.  I’m going with 40 GB disk size for the VM, so roughly 200 GB will be used.

  • Master Image (Do not change once all patched)
  • Windows Domain Controller
  • Microsoft SQL Server
  • AppServer.  This is optional if you want to save space and piggy-back your potential test application from the SQL VM.
  • Client machine.  Not necessarily on the domain.  This will be your client device / scan box / non-domain network sniffer.

Let’s get started:
From VirtualBox, click the New button to create a new Virtual Machine.  Type: Microsoft Windows, Version: Windows 2016 (x64).  Name this initial VM ‘masterControlImg’ for sake of reference.  Click the box for ‘Create a virtual hard disk now’.  Let’s set the Memory option to ‘2048’ AKA 2 GB. Then click ‘Create’.  I want to add a note that the virtual machine name you enter here will also be the subfolder in your VMs folder for VirtualBox on your storage drive (on your actual main machine).  You will get weird errors if you try to make a VM the name of a folder that already is in that folder.  FYI to save you headaches on that note.
Next will be the Create Virtual Hard Disk screen.  Leave the path as-is since it will match the prior line about being in a folder named to your VM, ‘File size’ of 32 GB is fine (but I suggest 40 GB for when you start adding Active Directory services and Replication), ‘Hard disk file type’ to the default of VDI (VirtualBox Disk Image) is good, as is the ‘Storage on physical hard disk’ remaining set to Dynamically allocated.  Good, now we can press ‘Create’ on the virtual hard disk screen.

Now that VM is created, let’s go into it’s settings then onto the Storage tab.  The second drive should be a CD icon and on the right side you will see a drop-down when you click the CD icon.  Select ‘Virtual Optical Disk File…’ then browse on your local computer to where you saved that Windows Server 2016 ISO, click OK until you are back to your VMs listed on the ‘Oracle VM VirtualBox Manager’.

With the ISO mounted for Windows Server 2016, boot your VM to install.  Hurry up and wait.  Follow the prompts (you want Server 2016 with desktop experience) and select an Administrator password.  For the sake of this lab, we can use ‘Babydonthurtm3!’ without the quotes.
You will want to take note of this for later use, as this is the local administrator account for this install and your cloned virtual machines.  Wait for the installer to finish and when done, it will let you login and see your desktop.

0A01-VB_MakeVM_Template.png
0A02-VB_CreateVirtHD.png
0A03-VB_VMSettingsMenuDrop.png
0A04-VB_StorageSettingsCD.png
0A05-Mount_ISO.png
0A06_ISO_Mounted.png
0A07-StartVM_forOSInstall.png

Now the install process for Windows begins.

0A08-VM_Win2016Inst_01.png
0A09_VB_SelectOSInstall.png
0A10_WinInstallType_Custom.png
0A11_WhereInstallDriveSelect.png
0A12_InstallerProgressDetails.png
0A13_AfterReboot-SetLocalAdminPass.png

End of the Windows install process.  Let us login to this VM.

0A14_WindowsLogin_LocalAdmin.png

Minimize Server Manager for now.  We do not want to add any roles or features yet.

0A15_ServerManagerConsole.png
0A16_Desktop_LE-Version.jpg

Clicking the Settings Gear, we want to install Updates for our Template OS.

0A17_WindowsUpdates_Server2016.png

This will likely take quite some time.  Better to do it now than to need patching every other machine we make as well.

0A18_PatchesInstallingWinUpdates.png

Install the most recent windows update patches, reboot and log back in.  Once the patches finish, shut this VM down.  Avoid booting this VM into windows, since it will be our Source VM for new instances.
Then back on the Oracle VirtualBox VM Manager, go to Settings for your VM, then Network.  Change the Attached to from NAT to ‘Internal Network’.  You can make a custom name for ‘intnetLab01’ for ease of reference later, if you expand your VM labs.  This setting will allow all the other VMs we spawn to communicate with each other.  If you forget to do this step later for other VMs, come back here if you wonder why your VM cannot see the Active Directory Domain Controller.

Clone machine image prompts:

01-VB_CloneVM.png
01-VB_CloneVM_MenuDrop.png
02-VB_formCloneVM.png
03-VB_NamedClone.png
04-VB_FullCloneOpt.png
05-WaitCloning_Progress.png

With all of this done, let’s make a clone of this VM.  We will name this Clone ‘WinDC01_testFTB’ or the like, as it will be the Primary Domain Controller for our Windows Domain.  Be sure to check the ‘Reinitialize the MAC address of all network cards’ because you do not want the same MAC address trying to talk to another computer.  That would also cause issues with DHCP and all sorts of networking issues you do not want.  

You do want to make it a Full Clone instead of a linked clone.  Wait for the clone process to finish, then boot up your newly spun ‘WinDC01_testFTB’ VM.

Log in to the desktop.  Before you get started making this a domain controller, we want to SysPrep this machine.  The action of this command will make it seem like a new windows install with the most important result being it will have a new SID / Windows Install ID.  As you dig into active directory, you will see AD links the machine name to it’s install ID / SID as a unique identifier.  If that didn’t make a lot of sense, know that running Sysprep will allow us to join each of our copied VMs into this test domain, without machine conflict issues.

Click Start and then Run cmd.exe.  If it’s not prefixed with ‘Administrator: Command Prompt’ in the title bar, click Start, type cmd then right-click to Run As Administrator.
In this prompt type:

cd %systemroot%\system32\sysprep

then type:

sysprep /generalize /oobe


A brief prompt will come up as it prepares your install then it will shut down the VM.  Once that happens, start the VM back up and it will take you through a prompt similar to when you installed the OS.  Once done, you will be back at the desktop.  If it asks for an Administrator password again, take note of what you use and write it down.  You are welcome to use the Haddaway example from above again.
Jumping back to the Sysprep process, you will need to do this for each image you clone from your VM template.  I also wanted to mention %systemroot% that is an environmental variable in Windows.  If you get to writing scripts, environmental variables are quite the blessing to your sanity.  You can use them in powershell to some extent also, so the fun pays off there.
Final ramble about SysPrep.  If you try to do this on an Image that had AD Roles and Features installed, it will likely not re-activate the 180 day trial for Windows Server and if it was an AD services image, it will likely error on the sysprep process.  That’s why we have our base image 🙂

20-NetworkSettings_Ethernet.png

Let’s wrap this up getting you a domain created.  Starting off, let’s set this machine to have a Static IP Address.  In the TaskBar down in the lower right by the Time, right-click the Network icon and then click ‘Connections’: Ethernet.  On the Ethernet status page, click Properties then Internet Protocol Version 4 (TCP/IPv4)  In the screencap you can see I went with:
10.0.2.10 on a /24 Subnet (AKA 255.255.255.0)

21-IPSettings_Ethernet.png

Pick a default gateway that will be the same for all other VMs made, intended to connect to this AD setup.
For the DNS, I put it’s own IP but 127.0.0.1 (loopback) works too.  If and when you add a second DNS and AD Server, I highly advise making your second DNS server be the IP of that other DC.  It will make domain fail-over really easy and reliable if you shut down your primary DC or practice a patching cycle like as would be done in a production setting.

Another good thing to do, is Changing the Computer Name.  By default it will be something like ‘WIN-StringofTextandNumbers’.  For sanity’s sake you can rename this to ‘WinDC01FTB’ or something more descriptive.  To change the computer name, bring up an Explorer window then right-click on ‘This PC’ then select Properties.  Click Change Settings to change the Computer name, then reboot as it will ask you to do.

22-SystemPCName.png

When you run the AD wizard without setting a static IP address, it will give you a warning about resolution issues.  So that’s why we took care of that before using the Server Manager to add roles and features.  Take my word on it being annoying to change a computer name, once you add roles and services.  Planning to do the PC name change before adding roles will save you headaches.

Since we are in VirtualBox, select Devices menu then the ‘Insert Guest Additions CD Image’ if you would like to use options such as ‘Shared Clipboard’ and ‘Drag and Drop’ files.  Once the image is mounted in your VM, run the installer from it’s CD drive then reboot when it’s finished as it will prompt.  This is helpful for when you want to get or send files and text to the VM and your actual desktop machine.  Unless you like manually retyping scripts, I’d suggest adding these Guest Addons.

Wrapping this guide up, I am pivoting to a helpful guide for Installing AD Services:
http://www.rebeladmin.com/2016/10/step-step-guide-setup-active-directory-windows-server-2016/
Jump to Step 4 and it will show you click for click on adding the Active Directory Domain Services under Server Manager | Roles and Features.

I am going to present a bit of a shortcut / cheat.  Instead of clicking lots of next boxes, we can supply the config options by use of Powershell.  The below is the script I saved from the Wizard when it presented ‘Export Configuration Settings’.  You can run this in a Powershell ISE window or save it to a text file and add a .ps1 on the name to make it a powershell script.

#
# Windows AD DS Deployment
#
Import-Module ADDSDeployment
Install-ADDSForest `
-CreateDnsDelegation:$false `
-DatabasePath "C:\Windows\NTDS" `
-DomainMode "WinThreshold" `
-DomainName "hivelan.int" `
-DomainNetbiosName "HIVELAN" `
-ForestMode "WinThreshold" `
-InstallDns:$true `
-LogPath "C:\Windows\NTDS" `
-NoRebootOnCompletion:$false `
-SysvolPath "C:\Windows\SYSVOL" `
-Force:$true

This should let you spawn your Domain as if you entered these values in the Wizard.  In this setup we are calling the domain ‘Hivelan.int’, with a classic domain name of just Hivelan (for Window NT level old support).  On a reboot you should be able to login to the Domain you just created.

From here, the virtual domain is your oyster.  You can make another clone of your Template machine, sysprep it, then join it to the domain.  Since we didn’t add the DHCP Server role to the current DC, go into your IP options and set all the IP info the same, except the IP address where you want the last octet (4th block of 3 digits) to be different than .10.
Then once on the same IP Space (your 255.255.255.0 subnet, means you can have an IP of 10.0.2.1 – 10.0.2.254).  Go into System Properties on this new VM.  Change your Computer name if you wish but the real objective is to change from a Workgroup to a Domain.  Enter ‘Hivelan.int’ as your domain and it should prompt for the Administrator account and Password.  You can always make a second domain admin account if you wish, but that boils into using Active Directory Users and Computers in Administrative Tools.

Once you add this machine to the domain and reboot, jump back into the Server Manager to add the Active Directory Domain Services on this machine, but we will say ‘Add to an existing domain’.  Click Next until it’s finished.

This guide got a little longer than I intended but I will stop here for the time being.  You can then make another clone of your Template VM and use that as a machine not on the domain.  Give it an IP address in the allotted space and you can use that for running Wireshark to see what kind of traffic you see.  You can then add that machine to the domain or make another VM clone to see how the traffic differs for a machine that is added to the domain.

Hopefully that helped get you into a test Windows environment and gave some help on getting started with VirtualBox.  If you have the funding and another Virtual Machine platform you like more (like XenServer or VMware), most of the concepts and options should be transferable and have similar naming.

Task details grep-like filtering

Say you are checking you tasklist output for a certain Windows process id (pid) that matches your netstat -o output.  These commands are helpful but matching the output can be annoying, even if you output them to a text file.  By the way, context wise this process is a throwback to the Bitcoin Miner Malware removal thread, as it could help for any open port you want to reference back to a running process.

If you want to see what said PID in your netstat output is with a single CLI string, here is a helpful pipe option.
tasklist | findstr “PID#”

IE: running tasklist | findstr “812” on my system throws details on wininit but also shows other process IDs with 812 in them.

I think of this as a light grep-like command you can do in Windows.  Like Linux, ‘|’ (piping) will take the output of your first command and run the 2nd command against it.  The tasklist find is a common and moderately easy grep-like thing you may want to do often if you are checking a machine for open ports and trying to correlate what process details are for said PID linked to those open ports.

Android security overview

I will edit this over time but I wanted to have the thread up to start with.

Overview objectives:
– Stop camera from saving GPS to photos.
  – This is in your Camera App Settings, not System device settings.
– Device Settings:
  – Lock Screen and Security:
    – Set lock mode and passcode to unlock device.
      – Password, PIN, Pattern, Swipe, None.
      – Biometrics. Face, Iris or Fingerprints
        – I do not use or particularly like any of the biometric means for device locking.
        – App Shortcuts: Define what apps can be used while phone is locked (IE Phone calls and Camera)
        – Find my mobile. Anti-theft and traacking options for your phone.
          – Remove controls: Allows phone to be remotely controlled via your Samsung account
          – Google location service.  Allow GLS to give more accurate location info to where your mobile is.
          – Send last location.  Allow your phone to broadcast last location when battery hits a certain level of charge.
        – Encrypt SD Card.  Your files on the SD card will only work with your phone.  If phone is reset to defaults, you will not be able to read the encrypted files anymore and would have to re-format the card.
  – Secure Lock Settings
    – Secured lock time
    – Auto factory reset. After 15 failed passwords (will also erase all your data on phone)
    – Lock network and security. Prevents disabling Wifi and mobile data when your phone is locked, to make someone stealing your phone easier to track by device.
  – Notifcations.  Choose to hide notification messages on lock screen.
      – Define what apps can put notifcations on the lock screen.
      – Hide content of message on lock screen from displaying. (Highly suggested to be on)
      – Notification icons only.  Just show app icon without details, on lock screen.

– Device Settings
  – Location
    – Turn GPS on or Off.  Besides privacy and tracking being less accurate, this can save a large amount of battery life.  Turn this off when not needed for directions.
    – Google Location History.  You can disable this from saving where you have searched and have been.
    – Google Location Sharing.  Can share ‘Real-time location’ with someone of Google.
    You can turn both of these off and GPS maps will still work fine.  The sharing and history are not needed, just GPS being turned on.

– Device Settings:
  – Apps.
    – See installed apps
      – Review and define App-specific system-level Permissions granted to device.
      – Decide if you wish to disable some apps completely or uninstall them.
      – Review battery usage and mobile data use, per app.

– Device Settings:
  – About phone.
    – Shows phone number, model, serial number and IMEI.
    – Software Information.
      – Show Android version
      – Android patch level
      – Various system level information.

PasswordSetting.gif

OS X screens and updates

I have done some maintenance on Mac laptops before and have a Mac Mini myself.  I haven’t had any issues with the Mini, but I did with a 2015 Macbook Pro.  Initial issue was some screen damage that looks like a residue stuck on the screen.  Turns out that was an issue with some Mac models, including the Macbook Pro 2015 model due to the anti-glare coating they used.  Fortunately, since they got their laptop at an Apple store, they had 4 year coverage and the repairs were free.  There is also a recall / free replacement for the logic board.  That repair was $575, before the cost was zeroed out because a warranty repair.  The new screen was crystal clear again and the laptop continues to soldier on.  We got this repaired in January of this year.

Item NumberDescriptionPriceAmount Due
S1586LL/ALabor Charge, PBG4/MBP15″$ 100.00$ 0.00
S5741LL/AFlat Rate 2 Repair Charge MBP15/MBP17$ 475.00$ 0.00
Total (Tax not included)$ 575.00$ 0.00

Lo and behold, I was visiting a couple days ago, and the same MacBook Pro (2015) rebooted to give the following error:
[auth] failed to write file <private>
At the bottom of an error log display.  if you have an nvidia MacBook Pro 2015) and update to 10.13.4, you’re gonna have a bad time. https://discussions.apple.com/thread/8338509

I followed the suggestion to select the Boot Disk option, then to pick the Mac Hard Drive to have it boot normally.  This 10.13.4 issue looks to have just started again the other day (5/30).  Hopefully an update will address this, because a recovery log screen is pretty daunting, especially for someone who does not normally see error logs, as I will generalize and say is the case for many Mac users who do not work in tech.  Needless to say they were happy when I got it to boot back up and she will continue delaying the prompts to install updates on OS X.

Forensic drive imaging with dd

Raspberry Pi dd imaging guide.

Preface:
This guide is for sharing a forensic approach to imaging a hard drive or solid state device.  I tend to not see many forensically tooled guides, so this one covers imaging from the perspective, that you need a verifiable image of a drive you will be working with.  I am writing it will full intent to be useful without needing to have a Write-blocker or needing to run and wait for the sha256 signature checks to be run.  In effort to be accessible I will cover the imaging of a Raspberry Pi with Raspbian and getting that running.  If you are familiar with that process, please jump ahead to the Action section.
My logic for using a Raspberry pi is because they are some of the cheapest functional computers one can get.  My logic for imaging the Pi fresh from an ISO, is to be sure no extra data is left over on the Pi from any previous projects you might have been doing in the past.

I want to add a side-note that you can follow the steps under action for almost any Linux distribution on various hardware.  I have done similar on a current era laptop running Tails before.  Your CPU heavy tasks like sha256sum will likely run much faster than on the Pi 2 I used for this guide. USB hard drive performance may also run higher based on your USB drive connectors and laptop, versus a Raspberry Pi 2.  Just for point of reference, I wanted to mention this.

Preparation:
Tools needed:

  • Raspberry Pi
  • SD Card
  • A USB to MicroSD reader (to image your Pi)
  • Power Supply
  • HDMI Display
  • Keyboard and probably a mouse
  • Post-It notes to label your drives
  • A USB powered hub (you want this for use with the external drives)
  • A USB SATA Dock
  • USB Write-blocker to prevent making changes to source drive. (or you can use a second USB dock but cannot count on the full unchanged integrity of the source USB drive.)

As I mentioned the Write-blocker, that will increase your cost quite a bit. Roughly $300 if you are going to use a Cru ComboDock 5.5 that I use.  You are still fully able to follow this guide without one, but minor changes to your source drive may happen while you read data from it (especially if you browse the drive contents and it generates thumbs.db files) and that would cause a problem in the sake of capturing a forensically sound image of that source drive.

With that noted, let’s get the Raspberry Pi ready to go with a fresh install of Raspbian OS.

Download latest Rasbian to your main computer you are reading this from.
Install to sd card with etcher imager (resin.io is the imager I used to write the .iso to MicroSD Card)
Put sd card in your Pi and boot it up.
Bring up a terminal and set pi passwd (default password is: raspberry)
Raspberry Pi Configuration can be found under Preferences on the menu of Raspbian Desktop.  On this first tab of System you can change the bottom options:

  • Disable auto login
  • Boot to CLI

Now that we have the Pi booted and setup, let’s jump into the Actions portion of the imaging.

Actions

Hook up source drive (If no write-blocker, use a USB drive bay / or external drive).  Follow the below steps to identify your source drive.
No gparted on Raspbian anymore, so use Parted in the terminal.

sudo parted -l

Typically the first usb drive will be /dev/sda.  Also cross reference the output to make sure it matches to the size of the drive you just hooked up. (500 GB source drive in my case)
You can also  type ls /dev/sd* in a terminal to see what drive is connected.  Now that we know what the source drive is, go ahead and hook up the destination drive you are using to be the clone of your source drive.
In another terminal, type sudo parted -l again.  In my case I now see a /dev/sdb.  This is my second drive I will be using to write the clone of the source drive to. (1000 GB destination drive in my case)

For your sake, this is where I recommend using post-it notes to write a note to put on each disk, stating what one is the source and it’s /dev/path.  Also doing the same for your destination and it’s /dev/path.

Source drive is /dev/sda
Dest drive is /dev/sdb

With that out of the way, we are ready to jump into the long haul of running  a dd command.  This will copy the data from your source drive, block for block to the destination drive.  dd is quite a serious command and can result in data loss if you do it wrong.  Here is where a write-blocker is especially useful to prevent overwriting the drive.  Also this is where the notes on the physical disk are helpful.  Below is the command for the setup we outlined.

dd if=/dev/sda of=/dev/sdb bs=16384k status=progress

Let’s break this command down.  I look at the if= being equal to Input file.  That’s our source drive.  of= being Output file.  This is where our destination drive is being overwritten.  bs= is Block Size.  I go with 16384k as it is a block size I have seen around good for imaging.  status=progress is a nice add-on so you can see the results of the dd command.  Otherwise you would be waiting for the progress to output once it is done.
This will take quite some time. 500 GB source to a 1TB destination drive.  Easily took about 8 hours as the finished results state:
27184.1 s, 18.4 MB/s.  Divide that by 60, then again by 60 and I got 7.55 hours to image a 500 GB drive to a 1 TB drive.
Hurry up and wait as you are doing a block for block image, so it even will copy the blank space to the destination drive.

Once done, verify each drive matches (Especially for forensic sake and use of write blocker).
Drive to drive sha will not match, so you want to do it for the partitions specifically.  Once again, be warned that it took around 7 hours on this Pi setup to run sha256sum against each one of these partitions.  Below are the commands I ran to generate the sha256 signature, followed by their matching results.

sha256sum /dev/sda1
sha256sum /dev/sdb1

813dcb6470f62c7c12623a0ef092551965b83e501e70dff4e01e1220cebf0129  /dev/sda1
813dcb6470f62c7c12623a0ef092551965b83e501e70dff4e01e1220cebf0129  /dev/sdb1

Bingo!  Image is a success and the source partition is a match to our cloned partition.  For conversations sake, if you were to run sha256sum against the entire disks, they would not match up.  Keep in mind the destination drive I used is a 1TB disk, so it has more free space than does the source drive.

Here are examples of mismatched checksum, because we compared the entire disks where one was larger than the other.

83b3b53d577d0ae793c947220b4ef3aa3d323e8349e0d3615b77964ec5baeb80  /dev/sda
f24189b6160b9a91bf5037ade4d4ab2f45a9bad9ebe254c0a349688f8987bc10  /dev/sdb

That concludes this guide.  If you have an questions or feedback, reply in this thread or hit me up online.  Thank you for reading and visiting. :)
Original thread

Firefox transparent glitch headless

This is a weird mix of conditions, so let me start with the overview. You are logged in remotely and most everything works fine, except Firefox. Extra details are that I changed the input on my LCD last night, so technically it’s a headless display since my Windows 10 PC does not see an active display hooked up.

Extra rub with that, is my normal display is running DisplayPort. When I switch inputs to HDMI to play Switch games, my open program windows resize to native resolution for Windows 10 (1024×768 iirc). Back to the issue at hand, over a remote session firefox does not load.

Stepping back, I figure this is related to the GPU hardware support, but its failing since there is no active display. I would turn that off in the program, but well, it doesn’t load beyond a transparent window. How else is there to change the program configuration? prefs.js has the option flags we want to change for disabling hardware rendering.

You can use the system variable to get into you AppData folder by typing %appdata% in a cmd prompt or into the file path of an explorer window. Once in your user AppData roaming folder, you should see Mozilla\Firefox\Profiles\{random}.default.
In that folder, open prefs.js with a text editor.

Keying off this guide, I was able to add the below 2 lines to my prefs.js (making sure Firefox is not running while doing so)


user_pref(“layers.acceleration.disabled”, true);
user_pref(“gfx.direct2d.disabled”, true);


After saving the file then loading firefox, I was able to get a working browser without an active display. Weird glitch to keep in mind if you are running a headless Windows 10 install. Be in intentional or on accident.