From 84400ac9822c3c4b387173faaeb4d9c20a78d35f Mon Sep 17 00:00:00 2001 From: Wesley Kerfoot Date: Thu, 19 Dec 2019 14:48:39 -0500 Subject: [PATCH] turn into a real package --- adb_poof.nimble | 14 ++++++++++++++ adb.nim => src/adb_poof.nim | 22 ++++++++++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 adb_poof.nimble rename adb.nim => src/adb_poof.nim (91%) diff --git a/adb_poof.nimble b/adb_poof.nimble new file mode 100644 index 0000000..480ec23 --- /dev/null +++ b/adb_poof.nimble @@ -0,0 +1,14 @@ +# Package + +version = "0.1.0" +author = "Wesley Kerfoot" +description = "Android Debug Bridge Swiss Army Knife" +license = "MIT" +srcDir = "src" +bin = @["adb_poof"] + + + +# Dependencies + +requires "nim >= 1.0.9" diff --git a/adb.nim b/src/adb_poof.nim similarity index 91% rename from adb.nim rename to src/adb_poof.nim index d0dc7c6..49eab11 100644 --- a/adb.nim +++ b/src/adb_poof.nim @@ -1,5 +1,5 @@ import net, strutils, parseutils, strformat, osproc, sequtils -import system, times, math, sugar +import system, times, math, sugar, os, streams import options except map type FileStat = ref object of RootObj @@ -250,12 +250,26 @@ proc rebootPhone() : Option[string] = makeMsg("reboot:").runCommand.parseAdb proc listCerts() : string = - makeMsg("shell:ls /etc/*").runCommand.parseAdb.get + makeMsg("shell:ls -1a /etc/security/cacerts/*").runCommand.parseAdb.get proc devices() : Option[string] = makeMsg("host:version").runCommand.parseAdb discard execCmd("adb start-server") -#discard adbSend("./test.opus".readFile, "/storage/7AFD-17E3/cakerave.opus", "777") -#"./cakerave.opus".writeFile(adbPull("/storage/7AFD-17E3/testmyshit").get.androidFileContents) +proc parseCerts() = + for cacert in listCerts().split("\n"): + let certfile = adbPull(cacert) + if certfile.isSome: + let filename = cacert.extractFilename + echo "Downloading " & filename + var fileContents = certfile.get.androidFileContents + var certFileStream = fileContents.newStringStream + +proc pemRead(fp : pointer, + x : pointer, + pem_password_cb : pointer, + u : pointer) : pointer {.cdecl, dynlib: "libssl.so", importc.} + + +parseCerts()