Browse Source

turn into a real package

master
Wesley Kerfoot 4 years ago
parent
commit
84400ac982
  1. 14
      adb_poof.nimble
  2. 22
      src/adb_poof.nim

14
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"

22
adb.nim → 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()
Loading…
Cancel
Save