김가영

data 전송 기능 추가

@echo
cd C:\Users\%USERNAME%\Desktop\batch_file
adb devices > C:\Users\%USERNAME%\Desktop\batch_file\device.csv
adb shell dumpsys alarm > C:\Users\%USERNAME%\Desktop\batch_file\alarm.csv
adb shell ps -A > C:\Users\%USERNAME%\Desktop\batch_file\process.csv
adb shell uptime > C:\Users\%USERNAME%\Desktop\batch_file\uptime.csv
adb shell getprop ro.product.model > C:\Users\%USERNAME%\Desktop\batch_file\model.csv
adb shell getprop ro.build.version.release > C:\Users\%USERNAME%\Desktop\batch_file\sdk_version.csv
adb shell getprop ro.build.version.sdk > C:\Users\%USERNAME%\Desktop\batch_file\android_version.csv
adb devices > C:\Users\%USERNAME%\Desktop\batch_file\device.txt
adb shell dumpsys alarm > C:\Users\%USERNAME%\Desktop\batch_file\alarm.txt
adb shell ps -A > C:\Users\%USERNAME%\Desktop\batch_file\process.txt
adb shell uptime > C:\Users\%USERNAME%\Desktop\batch_file\uptime.txt
adb shell getprop ro.product.model > C:\Users\%USERNAME%\Desktop\batch_file\model.txt
adb shell getprop ro.build.version.release > C:\Users\%USERNAME%\Desktop\batch_file\sdk_version.txt
adb shell getprop ro.build.version.sdk > C:\Users\%USERNAME%\Desktop\batch_file\android_version.txt
adb install -r app-release.apk
start cmd.exe /k "node data.js"
adb shell am start -n com.example.dataextraction/com.example.dataextraction.LoadingActivity
......
......@@ -18,6 +18,15 @@ function extractDB () {
console.log("move innerDB");
cmd_moveNdb = fs.rename('apps/com.example.dataextraction/db/networkDatabase.db', 'networkDatabase.db',function(){
console.log("move network db");
python_execute = exec('python data_sender.py',
function (error, stdout, stderr) {
console.log("python code execute")
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
})
})
})
......
import os.path
import requests
def data_check(data_path):
while(True):
if(os.path.isfile(data_path)):
print("file")
break
else:
print("x")
continue
data_transfer(data_path)
def data_transfer(data_path):
with open(data_path, 'rb') as files:
header = {'Authorization':'Bearer ',}
upload = {'file':files}
response = requests.post('http://13.209.3.132/extractions', files=upload, headers=header)
print(response.text)
def main():
path = os.path.expanduser('~')+"\\Desktop\\batch_file\\"
data_tup = [path+"android_version.txt", path+"alarm.txt", path+"device.txt", path+"model.txt", path+"process.txt", path+"sdk_version.txt", path+"uptime.txt", path+"InnerDatabase_test.db", path+"networkDatabase_test.db"]
for i in data_tup:
print(i)
data_check(i)
main()