Use Java to create a tool to generate cookies and headers dictionaries

Source: Internet
Author: User
Tags gettext

First on:

The data that often comes out when you grab a packet is this:

You need to manually build the key-value pairs of the data for each simulation.

This is a tedious and error-prone operation, so I'm going to do a little gadget like this.

Analyze text discovery to search for replacements directly

Java source code:

Package Com.mycompany.myapp2;import Android.app.*;import Android.os.*;import android.view.*;import android.widget.*    ;p ublic class Mainactivity extends Activity {String a= "";        @Override protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);    Setcontentview (R.layout.main); }public void Onheadersbuttonclick (view view) {TextView textView3 = (TextView) Findviewbyid (R.ID.MAINEDITTEXT1); Tex Tview3.gettext (); A=a+textview3.gettext (); String b= a.replace ("\ n", "', \ n '"), B=b.replace (":", "': '"), b= "{\ n" "+b+" ' \ n} "; TextView textView2 = (TextView) Findviewbyid (R.ID.MAINEDITTEXT2); Textview2.settext (b); a= "";} public void Oncookiesbuttonclick (view view) {TextView textView3 = (TextView) Findviewbyid (R.ID.MAINEDITTEXT1);//TEXTVI Ew3.gettext (); A=a+textview3.gettext (); String b= A.replace ("", ""); B=b.replace (";", "', \ n '");//b=b.replace ("; \ n", "', \ n '"); B=b.replace ("=", "': '"); b= "{\ n" " +b+ "' \ n}"; TextView textView2 = (TextView) Findviewbyid (R.id.mainediTTEXT2); Textview2.settext (b); a= "";}} 

The XML code for the layout:

<?xml version= "1.0" encoding= "Utf-8"? ><linearlayoutxmlns:android= "http://schemas.android.com/apk/res/ Android "Android:layout_width=" Match_parent "android:layout_height=" match_parent "android:orientation=" vertical " Android:gravity= "Top|center" ><linearlayoutandroid:orientation= "vertical" android:layout_width= "Match_ Parent "android:layout_height=" 200DP "android:gravity=" center "><textviewandroid:layout_width=" Wrap_content "Android:layout_height=" wrap_content "android:text=" ccookies OR HEADERS: "android:textsize=" 20SP "/>< Edittextandroid:layout_width= "Match_parent" android:ems= "android:layout_height=" Match_parent "android:hint=" Please enter the original data: "android:gravity=" Top "android:id=" @+id/mainedittext1 "/></linearlayout><linearlayoutandroid : orientation= "Horizontal" android:layout_width= "Match_parent" android:layout_height= "Wrap_content" Android: gravity= "center" ><buttonandroid:layout_width= "wrap_content" android:layout_height= "Wrap_content" Android: Text= "COOKIES to Dicts" Android: onclick= "Oncookiesbuttonclick"/><buttonandroid:layout_width= "wrap_content" android:layout_height= "Wrap_ Content "android:text=" headers to Dicts "android:onclick=" Onheadersbuttonclick "/></linearlayout>< linearlayoutandroid:orientation= "vertical" android:layout_width= "match_parent" android:layout_height= "Match_ Parent "android:gravity=" center "><textviewandroid:layout_width=" wrap_content "android:layout_height=" Wrap_ Content "android:text=" dicts: "android:textsize=" 20sp "/><edittextandroid:layout_width=" Match_parent " android:ems= "android:layout_height=" match_parent "android:hint=" Conversion results here: "android:gravity=" Top "android:id=" @+ Id/mainedittext2 "/></linearlayout></linearlayout>

:

 

Use Java to create a tool to generate cookies and headers dictionaries

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.