Browse Source

Initial commit

Ian Adam Naval 5 years ago
commit
a03cfc9171

+ 8
- 0
.classpath View File

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

+ 2
- 0
.gitignore View File

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

+ 33
- 0
.project View File

@@ -0,0 +1,33 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<projectDescription>
3
+	<name>SMSpammer</name>
4
+	<comment></comment>
5
+	<projects>
6
+	</projects>
7
+	<buildSpec>
8
+		<buildCommand>
9
+			<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
10
+			<arguments>
11
+			</arguments>
12
+		</buildCommand>
13
+		<buildCommand>
14
+			<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
15
+			<arguments>
16
+			</arguments>
17
+		</buildCommand>
18
+		<buildCommand>
19
+			<name>org.eclipse.jdt.core.javabuilder</name>
20
+			<arguments>
21
+			</arguments>
22
+		</buildCommand>
23
+		<buildCommand>
24
+			<name>com.android.ide.eclipse.adt.ApkBuilder</name>
25
+			<arguments>
26
+			</arguments>
27
+		</buildCommand>
28
+	</buildSpec>
29
+	<natures>
30
+		<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
31
+		<nature>org.eclipse.jdt.core.javanature</nature>
32
+	</natures>
33
+</projectDescription>

+ 19
- 0
AndroidManifest.xml View File

@@ -0,0 +1,19 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+      package="com.ianonavy.spammer"
4
+      android:versionCode="1"
5
+      android:versionName="1.0">
6
+    <application android:icon="@drawable/icon" android:label="@string/app_name">
7
+        <activity android:name="com.ianonavy.smspammer.SMSpammer"
8
+                  android:label="@string/app_name"
9
+                  android:screenOrientation="portrait">
10
+            <intent-filter>
11
+                <action android:name="android.intent.action.MAIN" />
12
+                <category android:name="android.intent.category.LAUNCHER" />
13
+            </intent-filter>
14
+        </activity>
15
+
16
+    </application>
17
+    <uses-sdk android:minSdkVersion="3" />
18
+	<uses-permission android:name="android.permission.SEND_SMS" />
19
+</manifest> 

+ 13
- 0
project.properties View File

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

BIN
res/drawable/icon.png View File


+ 86
- 0
res/layout/main.xml View File

@@ -0,0 +1,86 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    android:orientation="vertical"
4
+    android:layout_width="fill_parent"
5
+    android:layout_height="fill_parent"
6
+    >
7
+<TextView android:id="@+id/Instructions"
8
+	android:layout_width="wrap_content"
9
+	android:layout_height="wrap_content"
10
+	android:text="@string/instructions"
11
+	/>
12
+<EditText
13
+	android:hint="@string/target_phone"
14
+	android:id="@+id/txtNumber"
15
+	android:completionThreshold="1"
16
+	android:layout_below="@+id/Instructions"
17
+	android:layout_width="fill_parent"
18
+	android:layout_height="wrap_content"
19
+	android:inputType="phone"
20
+	/>
21
+<EditText
22
+	android:hint="@string/message"
23
+	android:id="@+id/txtMessage"
24
+	android:layout_below="@+id/txtNumber"
25
+	android:layout_width="fill_parent"
26
+	android:layout_height="wrap_content"
27
+	android:gravity="top"
28
+	android:maxLength="160"
29
+	/>
30
+<TextView
31
+	android:text="@string/default_counter"
32
+	android:id="@+id/txtCounter"
33
+	android:layout_width="wrap_content"
34
+	android:layout_height="wrap_content"
35
+	android:layout_below="@+id/txtMessage"
36
+	/>
37
+<EditText 
38
+	android:id="@+id/txtNumberOfTimes"
39
+	android:layout_width="80dp"
40
+	android:layout_height="wrap_content"
41
+	android:layout_below="@+id/txtCounter"
42
+	android:inputType="number"
43
+	android:maxLength="2"
44
+	android:text="@string/default_times"
45
+	android:hint="@string/times"
46
+	/>
47
+<Button
48
+	android:id="@+id/btnSend"
49
+    android:layout_width="wrap_content" 
50
+    android:layout_height="wrap_content" 
51
+    android:text="@string/send"
52
+    android:layout_below="@+id/txtCounter"
53
+    android:layout_toRightOf="@+id/txtNumberOfTimes"
54
+    />
55
+<TextView
56
+	android:id="@+id/txtSentCounter"
57
+	android:layout_below="@+id/txtNumberOfTimes"
58
+	android:layout_width="wrap_content"
59
+	android:layout_height="wrap_content"
60
+	android:text="@string/default_sent_counter"
61
+	/>
62
+<Button 
63
+	android:text="@string/spam"
64
+	android:id="@+id/btnSpam"
65
+	android:layout_width="wrap_content"
66
+	android:layout_height="wrap_content"
67
+	android:layout_below="@id/txtCounter"
68
+	android:layout_toRightOf="@id/btnSend"
69
+	/>
70
+<Button
71
+	android:layout_below="@id/txtCounter"
72
+	android:text="@string/clear"
73
+	android:layout_toRightOf="@+id/btnSpam"
74
+	android:layout_height="wrap_content"
75
+	android:id="@+id/btnClear"
76
+	android:layout_width="wrap_content">
77
+	</Button>
78
+<TextView
79
+	android:id="@+id/txtFooter"
80
+	android:layout_below="@+id/txtSentCounter"
81
+	android:layout_width="wrap_content"
82
+	android:layout_height="wrap_content"
83
+	android:text="@string/footer"
84
+	/>
85
+
86
+</RelativeLayout>

+ 26
- 0
res/values/strings.xml View File

@@ -0,0 +1,26 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<resources>
3
+    <string name="app_name">Spammer</string>
4
+    
5
+    <string name="instructions">Enter the phone number of the recipient, the message, and 
6
+        the number of times you want to send it. Press the SPAM button to send the default 
7
+        spam message.\n</string>
8
+    <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>
9
+    
10
+    <string name="target_phone">Victim\'s Phone #</string>
11
+    <string name="message">Message</string>
12
+    
13
+    <string name="times">Times</string>
14
+    <string name="required_toast">Please fill out all of the fields.</string>
15
+    <string name="messages_sent">messages sent.</string>
16
+    
17
+    <string name="default_counter">0/160</string>
18
+    <string name="default_times">10</string>
19
+    <string name="default_sent_counter">0 messages sent.\\n</string>
20
+    
21
+    <string name="spam">SPAM</string>
22
+    <string name="send">Send</string>
23
+    <string name="sending">Sending...</string>
24
+    <string name="clear">Clear</string>    
25
+    <string name="footer">Created by Ian Naval.</string>
26
+</resources>

+ 5
- 0
src/com/ianonavy/smspammer/GhostActivity.java View File

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

+ 52
- 0
src/com/ianonavy/smspammer/SMSHandler.java View File

@@ -0,0 +1,52 @@
1
+package com.ianonavy.smspammer;
2
+
3
+import android.app.Activity;
4
+import android.app.PendingIntent;
5
+import android.content.Intent;
6
+import android.telephony.gsm.SmsManager;
7
+
8
+public class SMSHandler {
9
+
10
+	Activity activity;
11
+	Thread spamThread;
12
+	String number;
13
+	String message;
14
+	int numTimes;
15
+	
16
+	public SMSHandler(Activity activity) {
17
+		this.activity = activity;
18
+		
19
+		number = "";
20
+		message = "";
21
+		numTimes = 0;
22
+		
23
+		spamThread = new Thread() {
24
+			public void run() {
25
+				while (true) {
26
+					if (numTimes > 0) {
27
+						sendSMS(number, message);
28
+						try {
29
+							Thread.sleep(2000);
30
+						} catch (InterruptedException e) {
31
+							e.printStackTrace();
32
+						}
33
+						numTimes--;
34
+					}
35
+				}
36
+			}
37
+		};
38
+		spamThread.start();
39
+	}
40
+
41
+	private void sendSMS(String number, String message) {        
42
+        PendingIntent pi = PendingIntent.getActivity(activity, 0, new Intent(activity, GhostActivity.class), 0);                
43
+        SmsManager sms = SmsManager.getDefault();
44
+        sms.sendTextMessage(number, null, message, pi, null);        
45
+    }
46
+
47
+	public void spam(String number, String message, int numTimes) {
48
+		this.number = number;
49
+		this.message = message;
50
+		this.numTimes = numTimes;
51
+	}
52
+}

+ 114
- 0
src/com/ianonavy/smspammer/SMSpammer.java View File

@@ -0,0 +1,114 @@
1
+package com.ianonavy.smspammer;
2
+
3
+import android.app.Activity;
4
+import android.app.PendingIntent;
5
+import android.content.Intent;
6
+import android.os.Bundle;
7
+import android.telephony.gsm.SmsManager;
8
+import android.text.Editable;
9
+import android.text.TextWatcher;
10
+import android.view.View;
11
+import android.widget.Button;
12
+import android.widget.EditText;
13
+import android.widget.TextView;
14
+import android.widget.Toast;
15
+
16
+import com.ianonavy.spammer.R;
17
+
18
+public class SMSpammer extends Activity implements TextWatcher {
19
+	EditText txtNumber;
20
+	EditText txtMessage;
21
+	EditText txtNumberOfTimes;
22
+	TextView txtCounter;
23
+	TextView txtSentCounter;
24
+	Button btnSend;
25
+	Button btnSpam;
26
+	Button btnClear;
27
+	
28
+	int numberSent = 0;
29
+	int numberOfTimes = 0;
30
+	
31
+	SMSHandler handler;
32
+	
33
+    @Override
34
+    public void onCreate(Bundle savedInstanceState) {
35
+        super.onCreate(savedInstanceState);
36
+        setContentView(R.layout.main);
37
+                
38
+    	txtNumber = (EditText) findViewById(R.id.txtNumber);
39
+	    txtMessage = (EditText) findViewById(R.id.txtMessage); 
40
+	    txtNumberOfTimes = (EditText) findViewById(R.id.txtNumberOfTimes);
41
+        txtCounter = (TextView) findViewById(R.id.txtCounter);
42
+        txtSentCounter = (TextView) findViewById(R.id.txtSentCounter);
43
+        btnSend = (Button) findViewById(R.id.btnSend);
44
+	    btnSpam = (Button) findViewById(R.id.btnSpam);
45
+	    btnClear = (Button) findViewById(R.id.btnClear);
46
+	    
47
+	    handler = new SMSHandler(this);
48
+        txtMessage.addTextChangedListener(this);
49
+                
50
+	    btnSend.setOnClickListener(new View.OnClickListener() {
51
+	    	public void onClick(View v) {
52
+	    		String number = txtNumber.getText().toString();
53
+	    		String message = txtMessage.getText().toString();
54
+	    		numberOfTimes = Integer.valueOf(txtNumberOfTimes.getText().toString()).intValue();
55
+	    		
56
+	    		if (txtMessage.length() > 0 && txtNumber.length() > 0 && txtNumberOfTimes.length() > 0) {
57
+	    		
58
+	    			txtMessage.setEnabled(false);
59
+	    			txtNumber.setEnabled(false);
60
+	    			txtNumberOfTimes.setEnabled(false);
61
+	    			btnSpam.setEnabled(false);
62
+	    			
63
+	    			handler.spam(number, message, numberOfTimes);	
64
+
65
+	    			numberSent += numberOfTimes;
66
+	    			updateCounters();
67
+	    			
68
+	    			btnSend.setText(getString(R.string.sending));
69
+	            	
70
+	            	txtMessage.setEnabled(true);
71
+	    			txtNumber.setEnabled(true);
72
+	    			txtNumberOfTimes.setEnabled(true);
73
+	    			btnSpam.setEnabled(true);
74
+	            	
75
+	            	btnSend.setText(getString(R.string.send));
76
+	    		} else {
77
+	    			Toast toast = Toast.makeText(getApplicationContext(), getString(R.string.required_toast), Toast.LENGTH_SHORT);
78
+	    			toast.show();
79
+	    		}
80
+	        }
81
+	    });
82
+	    
83
+	    btnSpam.setOnClickListener(new View.OnClickListener() {
84
+	    	public void onClick(View v) {
85
+	    		txtMessage.setText(R.string.spam_message);
86
+	    	}
87
+	    });
88
+	    
89
+	    btnClear.setOnClickListener(new View.OnClickListener() {
90
+	    	public void onClick(View v) {
91
+	    		txtMessage.setText("");
92
+	    	}
93
+	    });
94
+	    
95
+	    updateCounters();
96
+	    	    
97
+    }
98
+        
99
+	@Override
100
+	public void afterTextChanged(Editable arg0) {}
101
+
102
+	@Override
103
+	public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {}
104
+
105
+	@Override
106
+	public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {updateCounters();}
107
+    
108
+    private void updateCounters() {
109
+    	String length = Integer.toString(txtMessage.length());
110
+    	txtCounter.setText(length + "/160"); 
111
+    	txtSentCounter.setText(numberSent + " " + getString(R.string.messages_sent) + "\n");
112
+    }
113
+    
114
+}

Loading…
Cancel
Save