安卓开发短信小骗子
直接上項目代碼,技術很簡單就是一些對于數據庫的操作,不得不感慨安卓安全性實在是。。。。。。
主activity
package com.android.fromdaemonwry? ; //import java.sql.Date; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date ;import com.thisdaemonwry.messageliar.R;import android.view.View.OnClickListener; import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; import android.content.ContentResolver; import android.content.ContentValues; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.DatePicker; import android.widget.DatePicker.OnDateChangedListener; import android.widget.EditText; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TimePicker; import android.widget.TimePicker.OnTimeChangedListener; import android.widget.Toast;@SuppressLint("NewApi") public class Main extends Activity {private String num ;private String msg ;private int lyear,lmonth,lday,lhour,lminute ;private int FLAG=2 ;???? //1表示發件,2表示收件private RadioGroup group ;private EditText dateEt,timeEt ;private EditText numText ;private EditText msgtext ;private Button insert ;private TimePicker timePicker ;private DatePicker datePicker ;@Overrideprotected void onCreate(Bundle savedInstanceState) {// TODO Auto-generated method stubsuper.onCreate(savedInstanceState);setContentView(R.layout.main);this.numText = (EditText) findViewById(R.id.num) ;this.msgtext = (EditText) findViewById(R.id.text) ;this.insert = (Button) findViewById(R.id.insert) ;this.group = (RadioGroup)findViewById(R.id.group) ;this.datePicker = (DatePicker)findViewById(R.id.datePicker) ;this.timePicker = (TimePicker)findViewById(R.id.timePicker) ;this.dateEt = (EditText)findViewById(R.id.dateEt) ;this.timeEt = (EditText)findViewById(R.id.timeEt) ;//System.out.println("時間:"+lhour+"?? "+lminute) ;/** DatePicker監聽*/this.datePicker.setCalendarViewShown(false);Calendar cal = Calendar.getInstance() ;this.lyear = cal.get(Calendar.YEAR) ;this.lmonth = cal.get(Calendar.MONTH)+1 ;this.lday = cal.get(Calendar.DAY_OF_MONTH) ;this.lhour = cal.get(Calendar.HOUR_OF_DAY) ;this.lminute = cal.get(Calendar.MINUTE) ;dateEt.setText("你選擇的日期是"+lyear+"年"+(this.lmonth)+"月"+lday+"日");this.datePicker.init(lyear, lmonth-1, lday, new OnDateChangedListener() {@Overridepublic void onDateChanged(DatePicker view, int year, int monthOfYear,int dayOfMonth) {// TODO Auto-generated method stubdateEt.setText("你選的日期是"+year+"年"+(monthOfYear+1)+"月"+dayOfMonth+"日");lyear = year ;lmonth = monthOfYear +1;lday = dayOfMonth ;?? ?}});this.timeEt.setText("你選擇的時間:"+lhour+"點"+lminute+"分");this.timePicker.setOnTimeChangedListener(new OnTimeChangedListener() {@Overridepublic void onTimeChanged(TimePicker view, int hourOfDay, int minute) {// TODO Auto-generated method stublhour = hourOfDay ;lminute = minute ;timeEt.setText("你選擇的時間:"+lhour+"點"+lminute+"分");}});this.group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {@Overridepublic void onCheckedChanged(RadioGroup group, int checkedId) {// TODO Auto-generated method stubRadioButton rb = (RadioButton)findViewById(checkedId) ;if(rb.getId() == R.id.fajian){FLAG = 1 ;}else if(rb.getId() == R.id.shoujian){FLAG = 2 ;}}});this.insert.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View v) {// TODO Auto-generated method stubnum = numText.getText().toString() ;msg = msgtext.getText().toString() ;if(num.equals("") || msg.equals("")){Toast.makeText(getApplicationContext(), "電話號碼和短信內容不能為空!", Toast.LENGTH_LONG) ;return ;}/** 下面開始執行插入操作*/SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd HH:mm" );//String time="1970-01-06 11:45:55";String time = lyear+"-"+lmonth+"-"+lday+" "+lhour+":"+lminute;Date date = null;try {date = (Date) format.parse(time);} catch (ParseException e) {// TODO Auto-generated catch blocke.printStackTrace();}ContentValues value = new ContentValues() ;ContentResolver cr = getContentResolver() ;value.put("address", num);value.put("body",msg) ;java.sql.Date sqldate=new java.sql.Date(date.getTime());value.put("date", sqldate.getTime());if(FLAG == 1){value.put("type", 4);} else value.put("type", 1);if(FLAG == 1){getContentResolver().insert(Uri.parse("content://sms/sent"), value) ;//cr.insert(Uri.parse("content://sms/sent"), value) ;}else {getContentResolver().insert(Uri.parse("content://sms/inbox"), value) ;?? ?//cr.insert(Uri.parse("content://sms/inbox"), value)? ;}cr = null ;AlertDialog alert ;AlertDialog.Builder builder = new AlertDialog.Builder(Main.this) ;builder.setTitle("插入成功") ;builder.setMessage("短信偽造成功,剩下的你懂的。。") ;builder.setPositiveButton("查看已偽造的短信", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int which) {// TODO Auto-genIntent intent = new Intent();intent.setClassName("com.android.mms","com.android.mms.ui.ConversationList");startActivity(intent);}}) ;alert = builder.create() ;alert.show(); }});}}
布局xml
<?xml version="1.0" encoding="utf-8"?><ScrollView xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:background="@drawable/from"android:layout_height="wrap_content"> <LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical" ><EditText android:id="@+id/num"android:layout_width="fill_parent"android:layout_height="wrap_content"android:hint="在此輸入電話號碼"android:inputType="number"android:background="@drawable/bg_sms_input"/><EditText android:id="@+id/text"android:layout_width="fill_parent"android:layout_height="wrap_content"android:hint="在此輸入要制造的短信內容"android:layout_marginTop="18dp"android:gravity="top"android:background="@drawable/bg_sms_input"android:minLines="3"/><DatePicker android:id="@+id/datePicker" android:layout_width="wrap_content"android:layout_height="wrap_content"android:startYear="1975"android:endYear="2100"android:layout_gravity="center_horizontal"/><EditText android:id="@+id/dateEt"android:layout_width="fill_parent"android:layout_height="wrap_content"android:cursorVisible="false"android:editable="false"/><TimePicker android:id="@+id/timePicker" android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center_horizontal"/><EditText android:id="@+id/timeEt"android:layout_width="fill_parent"android:layout_height="wrap_content"android:cursorVisible="false"android:editable="false"/><RadioGroupandroid:id="@+id/group"android:layout_marginTop="10dp"android:orientation="horizontal"android:layout_width="fill_parent"android:layout_height="wrap_content"><RadioButton android:id="@+id/fajian"android:text="插入已發短信"android:layout_width="wrap_content"android:layout_height="wrap_content"/><RadioButton android:id="@+id/shoujian"android:text="插入已收短信"android:layout_width="wrap_content"android:layout_height="wrap_content"/></RadioGroup> <Buttonandroid:id="@+id/insert"android:textSize="25sp"android:layout_width="wrap_content"android:layout_height="wrap_content"android:padding="8dp"android:background="@drawable/selector"android:layout_gravity="center_horizontal"android:layout_marginTop="10dp"android:text="插入"/></LinearLayout></ScrollView>
效果圖
總結
- 上一篇: 银河麒麟系统加固
- 下一篇: 国外B端竞品调研网站一网打尽