Tag Archives: Shell

Backup Google Authenticator Database

Two factor authentication is great – I wish everything would use it.   My personal 2FA (specifically TOTP)  mobile app is Google Authenticator.  It allows you to scan a barcode, or manually enter a 2FA initilization token, and gives you a nice display of all of your stored 2FA tokens, with a great countdown of the token’s expiration.  However, it does have one critical flaw feature:  You can’t export your accounts.

Let me re-state that:  Your 2FA tokens are locked away in your mobile device.  Without the device, you’re locked out of your accounts (Hopefully you created backup codes).  If your device becomes inoperable, good luck!

However, if you have root access to your device, you can grab the Google Authenticator database and stow it away for safe keeping by grabbing it from the following location on your phone:

/data/data/com.google.android.apps.authenticator2/

If you have ADB enabled, you can just run the following command:

 adb pull /data/data/com.google.android.apps.authenticator2 

Keep this information very secure, as it can be used to generate 2FA codes for all of your accounts!

Root for LG D850

Re-post of http://forum.xda-developers.com/android/development/guide-root-method-lg-devices-t3049772

    1. Get LG Drivers Here: http://www.lg.com/us/support-mobile/lg-D850-Blue-Steel#software
    2. Download LG Root
    3. Use ADB Shell to copy the files to the temp directory on the phone
      adb.exe push busybox /data/local/t<span id="searchBubble" class="searchBubble"></span>mp/ &amp;&amp; adb.exe push lg_root.sh /data/local/tmp &amp;&amp; adb.exe push UPDATE-SuperSU-v2.46.zip /data/local/tmp
    4. Reboot into Download mode
    5. Use ports.bat to determine the DIAG port of the phone (Mine was COM 4)
    6. Use SendCommand.exe to get a shell within download mode
    7. Run the shell command to root the phone from download mode
      sh /data/local/tmp/lg_root.sh dummy 1 /data/local/tmp/UPDATE-SuperSU-v2.46.zip /data/local/tmp/busybox
    8. Reboot the phone
    9. To allow apps to write to external (http://www.mediamonkey.com/support/index.php?/Knowledgebase/Article/View/163/12/android-sd-card-content-cant-be-addedediteddeleted): Edit /system/etc/permissions/platform.xml
      <permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
              <group gid="sdcard_rw" />
              <group gid="media_rw"  />
          </permission>
    10. Reboot the phone

Cleaning Up Exchange Messages with Search-Mailbox

Like most sysadmins, I receive notifications from end users about SPAM showing up in their inbox.  While not all spam can be avoided, we can deal with it.  I wanted to lessen the impact of already delivered spam and potentially avert a crisis if the same phishing email is sent to all 1500 mailboxes, so I whipped up this script to search out and destroy these messages from my Exchange environment:

$Subject = “About your last transaction”
$StartDate = $(‘1/1/2015’)
$BodyLanguage = “sellam.fr”
$TargetMailbox = “spamdump”
$TargetFolder = “WHD2918”

$Search = [scriptblock]::Create(“Received>=`”$StartDate`” and Subject:`”$Subject`” and `”$BodyLanguage`””)

Get-Mailbox -ResultSize Unlimited | Search-Mailbox -SearchQuery $Search -targetmailbox $TargetMailbox -targetfolder $TargetFolder -loglevel full -logonly

Note the last flag in the last line of the script: “-logonly.”  Be very careful to run the command with this command the first go-round.  This ensures that the query you specify does not grab messages that it shouldn’t (and you wind up deleting everyone’s entire mailbox).  The result of logonly is an excel file in the target mailbox with the headers of the resultant messages.

After reviewing the messages, replace -logonly with -deletecontent.  This will actually move the messages from the users’ mailboxes into the target mailbox.

If you want to modify the query, take a look into how Search-Mailbox actually works.   Search-Mailbox uses KQL, so be sure to brush up on the syntax.  If you’ve beocme accustomed to the powershell boolean operators such as “-and,” You’ll be unpleasantly surprised when you learn that the same operator will evaluate to “not and” in KQL