Initial commit

This commit is contained in:
Ian Adam Naval 2014-05-22 04:07:32 -07:00
commit a03cfc9171
11 changed files with 358 additions and 0 deletions

8
.classpath Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
bin/
gen/

33
.project Normal file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>SMSpammer</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

19
AndroidManifest.xml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ianonavy.spammer"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name="com.ianonavy.smspammer.SMSpammer"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.SEND_SMS" />
</manifest>

13
project.properties Normal file
View File

@ -0,0 +1,13 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.
# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
target=android-3

BIN
res/drawable/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

86
res/layout/main.xml Normal file
View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView android:id="@+id/Instructions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/instructions"
/>
<EditText
android:hint="@string/target_phone"
android:id="@+id/txtNumber"
android:completionThreshold="1"
android:layout_below="@+id/Instructions"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="phone"
/>
<EditText
android:hint="@string/message"
android:id="@+id/txtMessage"
android:layout_below="@+id/txtNumber"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:maxLength="160"
/>
<TextView
android:text="@string/default_counter"
android:id="@+id/txtCounter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txtMessage"
/>
<EditText
android:id="@+id/txtNumberOfTimes"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_below="@+id/txtCounter"
android:inputType="number"
android:maxLength="2"
android:text="@string/default_times"
android:hint="@string/times"
/>
<Button
android:id="@+id/btnSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send"
android:layout_below="@+id/txtCounter"
android:layout_toRightOf="@+id/txtNumberOfTimes"
/>
<TextView
android:id="@+id/txtSentCounter"
android:layout_below="@+id/txtNumberOfTimes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/default_sent_counter"
/>
<Button
android:text="@string/spam"
android:id="@+id/btnSpam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/txtCounter"
android:layout_toRightOf="@id/btnSend"
/>
<Button
android:layout_below="@id/txtCounter"
android:text="@string/clear"
android:layout_toRightOf="@+id/btnSpam"
android:layout_height="wrap_content"
android:id="@+id/btnClear"
android:layout_width="wrap_content">
</Button>
<TextView
android:id="@+id/txtFooter"
android:layout_below="@+id/txtSentCounter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/footer"
/>
</RelativeLayout>

26
res/values/strings.xml Normal file
View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Spammer</string>
<string name="instructions">Enter the phone number of the recipient, the message, and
the number of times you want to send it. Press the SPAM button to send the default
spam message.\n</string>
<string name="spam_message">SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM </string>
<string name="target_phone">Victim\'s Phone #</string>
<string name="message">Message</string>
<string name="times">Times</string>
<string name="required_toast">Please fill out all of the fields.</string>
<string name="messages_sent">messages sent.</string>
<string name="default_counter">0/160</string>
<string name="default_times">10</string>
<string name="default_sent_counter">0 messages sent.\\n</string>
<string name="spam">SPAM</string>
<string name="send">Send</string>
<string name="sending">Sending...</string>
<string name="clear">Clear</string>
<string name="footer">Created by Ian Naval.</string>
</resources>

View File

@ -0,0 +1,5 @@
package com.ianonavy.smspammer;
public class GhostActivity {
}

View File

@ -0,0 +1,52 @@
package com.ianonavy.smspammer;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.telephony.gsm.SmsManager;
public class SMSHandler {
Activity activity;
Thread spamThread;
String number;
String message;
int numTimes;
public SMSHandler(Activity activity) {
this.activity = activity;
number = "";
message = "";
numTimes = 0;
spamThread = new Thread() {
public void run() {
while (true) {
if (numTimes > 0) {
sendSMS(number, message);
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
numTimes--;
}
}
}
};
spamThread.start();
}
private void sendSMS(String number, String message) {
PendingIntent pi = PendingIntent.getActivity(activity, 0, new Intent(activity, GhostActivity.class), 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(number, null, message, pi, null);
}
public void spam(String number, String message, int numTimes) {
this.number = number;
this.message = message;
this.numTimes = numTimes;
}
}

View File

@ -0,0 +1,114 @@
package com.ianonavy.smspammer;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.gsm.SmsManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.ianonavy.spammer.R;
public class SMSpammer extends Activity implements TextWatcher {
EditText txtNumber;
EditText txtMessage;
EditText txtNumberOfTimes;
TextView txtCounter;
TextView txtSentCounter;
Button btnSend;
Button btnSpam;
Button btnClear;
int numberSent = 0;
int numberOfTimes = 0;
SMSHandler handler;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txtNumber = (EditText) findViewById(R.id.txtNumber);
txtMessage = (EditText) findViewById(R.id.txtMessage);
txtNumberOfTimes = (EditText) findViewById(R.id.txtNumberOfTimes);
txtCounter = (TextView) findViewById(R.id.txtCounter);
txtSentCounter = (TextView) findViewById(R.id.txtSentCounter);
btnSend = (Button) findViewById(R.id.btnSend);
btnSpam = (Button) findViewById(R.id.btnSpam);
btnClear = (Button) findViewById(R.id.btnClear);
handler = new SMSHandler(this);
txtMessage.addTextChangedListener(this);
btnSend.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
String number = txtNumber.getText().toString();
String message = txtMessage.getText().toString();
numberOfTimes = Integer.valueOf(txtNumberOfTimes.getText().toString()).intValue();
if (txtMessage.length() > 0 && txtNumber.length() > 0 && txtNumberOfTimes.length() > 0) {
txtMessage.setEnabled(false);
txtNumber.setEnabled(false);
txtNumberOfTimes.setEnabled(false);
btnSpam.setEnabled(false);
handler.spam(number, message, numberOfTimes);
numberSent += numberOfTimes;
updateCounters();
btnSend.setText(getString(R.string.sending));
txtMessage.setEnabled(true);
txtNumber.setEnabled(true);
txtNumberOfTimes.setEnabled(true);
btnSpam.setEnabled(true);
btnSend.setText(getString(R.string.send));
} else {
Toast toast = Toast.makeText(getApplicationContext(), getString(R.string.required_toast), Toast.LENGTH_SHORT);
toast.show();
}
}
});
btnSpam.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
txtMessage.setText(R.string.spam_message);
}
});
btnClear.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
txtMessage.setText("");
}
});
updateCounters();
}
@Override
public void afterTextChanged(Editable arg0) {}
@Override
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {}
@Override
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {updateCounters();}
private void updateCounters() {
String length = Integer.toString(txtMessage.length());
txtCounter.setText(length + "/160");
txtSentCounter.setText(numberSent + " " + getString(R.string.messages_sent) + "\n");
}
}