package com.bawie.songzixin0414;

import android.app.Application;
import android.database.sqlite.SQLiteDatabase;

import com.bawie.songzixin0414.dao.DaoMaster;
import com.bawie.songzixin0414.dao.DaoSession;
import com.facebook.drawee.backends.pipeline.Fresco;

/**

  • @Author:asus

  • @E-mail: 945574298@163.com

  • @Date:2019/4/14 19:51

  • @Description:描述信息
    */
    public class App extends Application {

    private static DaoSession daoSession;

    @Override
    public void onCreate() {
    super.onCreate();
    Fresco.initialize(this);
    DaoMaster.DevOpenHelper songz = new DaoMaster.DevOpenHelper(this, “songz”, null);
    SQLiteDatabase writableDatabase = songz.getWritableDatabase();
    DaoMaster daoMaster = new DaoMaster(writableDatabase);
    daoSession = daoMaster.newSession();
    }

    public static DaoSession getDaoSession() {
    return daoSession;
    }
    }

package com.bawie.songzixin0414;

import android.net.Network;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.Toast;

import com.bawie.songzixin0414.adapter.MyAdapter;
import com.bawie.songzixin0414.bean.JsonBean;
import com.bawie.songzixin0414.bean.ShopBean;
import com.bawie.songzixin0414.dao.ShopBeanDao;
import com.bawie.songzixin0414.http.NetUtils;
import com.bawie.songzixin0414.mvp.presenter.Presenter;
import com.bawie.songzixin0414.mvp.view.IView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MainActivity extends AppCompatActivity implements IView {

@BindView(R.id.recyleview)
RecyclerView recyleview;
private ShopBeanDao userDao;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    recyleview.setLayoutManager(new LinearLayoutManager(this));
    Presenter presenter = new Presenter();

    presenter.AttachView(this);
    presenter.getpre();

    userDao = App.getDaoSession().getShopBeanDao();
    boolean network = NetUtils.isNetwork(this);
    if(network){
        presenter.getpre();
    }
    else{
        Toast.makeText(MainActivity.this,"没有网",Toast.LENGTH_SHORT).show();
        List<ShopBean> shopBeans = userDao.loadAll();
        if(shopBeans.size()==0){
            Toast.makeText(MainActivity.this,"没有缓存",Toast.LENGTH_SHORT).show();
        }
        else{
            ArrayList<ShopBean> list = new ArrayList<>();
             for(int i=0;i<shopBeans.size();i++){
                 String commodityName = shopBeans.get(i).getCommodityName();
                 String masterPic = shopBeans.get(i).getMasterPic();
                 String price = shopBeans.get(i).getPrice();
                 ShopBean shopBean = new ShopBean(commodityName, masterPic, price);
                 list.add(shopBean);
             }
             recyleview.setLayoutManager(new LinearLayoutManager(this));
             MyAdapter myAdapter=new MyAdapter(MainActivity.this,list);
             recyleview.setAdapter(myAdapter);

        }
    }


}

@Override
public void getView(Object obj) {
  JsonBean jsonBean= (JsonBean) obj;
    ArrayList<ShopBean> commodityList1 = jsonBean.getResult().getMlss().getCommodityList();

// ArrayList commodityList2 = jsonBean.getResult().getPzsh().getCommodityList();
// ArrayList commodityList3 = jsonBean.getResult().getRxxp().getCommodityList();
userDao.deleteAll();
for (int i=0;i<commodityList1.size();i++){
String commodityName = commodityList1.get(i).getCommodityName();
String masterPic = commodityList1.get(i).getMasterPic();
String price = commodityList1.get(i).getPrice();
// String commodityName1 = commodityList2.get(i).getCommodityName();
// String masterPic2 = commodityList2.get(i).getMasterPic();
// String price2 = commodityList1.get(i).getPrice();
ShopBean shopBean=new ShopBean();
// ShopBean shopBean1 = new ShopBean();
shopBean.setCommodityName(commodityName);
shopBean.setMasterPic(masterPic);
shopBean.setPrice(price);
// shopBean1.setCommodityName(commodityName1);
// shopBean1.setPrice(price2);
// shopBean1.setMasterPic(masterPic2);
userDao.insert(shopBean);
// userDao.insert(shopBean1);
}

    MyAdapter myAdapter=new MyAdapter(MainActivity.this,commodityList1);
    recyleview.setAdapter(myAdapter);

}

}

package com.bawie.songzixin0414.http;

import android.os.Handler;

import com.google.gson.Gson;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

/**

  • @Author:asus

  • @E-mail: 945574298@163.com

  • @Date:2019/4/14 19:31

  • @Description:描述信息
    */
    public class OKHttp {
    private OkHttpClient client;
    private static volatile OKHttp instance;
    private Handler handler=new Handler();
    //单列模式
    public static OKHttp getInstance(){
    if(instancenull){
    synchronized (OKHttp.class){
    if(null
    instance){
    instance=new OKHttp();
    }
    }
    }
    return instance;
    }
    public OKHttp(){
    client=new OkHttpClient.Builder()
    .connectTimeout(3000, TimeUnit.SECONDS)
    .readTimeout(3000,TimeUnit.SECONDS)
    .writeTimeout(3000,TimeUnit.SECONDS)
    .addInterceptor(new HeadInterceptor())
    .build();
    }
    //doget
    public void doGet(String url,final Class clazz,final NetCallBack netCallBack){
    final Request request=new Request.Builder()
    .url(url)
    .get()
    .build();
    Call call=client.newCall(request);
    call.enqueue(new Callback() {
    @Override
    public void onFailure(Call call, IOException e) {

         }
    
         @Override
         public void onResponse(Call call, final Response response) throws IOException {
             String string = response.body().string();
             Gson gson=new Gson();
             final Object o = gson.fromJson(string, clazz);
             handler.post(new Runnable() {
                 @Override
                 public void run() {
                     netCallBack.LoadOnSuccess(o);
                 }
             });
         }
     });
    

    }
    public void doPost(String url,String name,String pwd,final Class clazz,final NetCallBack netCallBack){
    client = new OkHttpClient();
    FormBody build=new FormBody.Builder()
    .add(“phone”,name)
    .add(“pwd”,pwd)
    .build();
    Request request=new Request.Builder()
    .url(url)
    .post(build)
    .build();
    Call call=client.newCall(request);
    call.enqueue(new Callback() {
    @Override
    public void onFailure(Call call, IOException e) {

         }
    
         @Override
         public void onResponse(Call call, Response response) throws IOException {
             String string = response.body().string();
             Gson gson=new Gson();
             final Object o = gson.fromJson(string, clazz);
             handler.post(new Runnable() {
                 @Override
                 public void run() {
                     netCallBack.LoadOnSuccess(o);
                 }
             });
         }
     });
    

    }
    public interface NetCallBack{
    void LoadOnSuccess(Object data);
    void LoadOnFail();
    }
    }

package com.bawie.songzixin0414.http;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**

  • @Author:asus

  • @E-mail: 945574298@163.com

  • @Date:2019/4/14 19:29

  • @Description:描述信息
    */
    public class HeadInterceptor implements Interceptor {

    @Override
    public Response intercept(Chain chain) throws IOException {
    Request request=chain.request();
    Request.Builder builder = request.newBuilder();
    builder.addHeader(“userId”,"");
    builder.addHeader(“sessionId”,"");
    Response proceed = chain.proceed(request);
    return proceed;
    }
    }

解码这是brainfuck编码的变种码:..... ..... ..!?! !... ..... ......?!..... ..... .............. ...!? !!.?! !!!!! ?.?!. ?!!!! !... ..... !?!!..... ...? !... ......... ..... !?!!. ?!!!! !!?.? !.?!! !!!...... ..... ..... !?!!..... ..... ......?!..... ..... ..... ..... ... ..... ..... ..!?! !.?!! !!!!! !!!!! ?.?!. ?!!!! !!!!! !!!!! !!!!! !!.. ..... ...!? !!.. ..... ...? !...... ..... ..!?! !.?!! !!!!! !?.?! .?!!! !!!!.... ..... !?!!. ?!!!! !!?.? !.?!! !!!...... ..!?! !... .....?!............... ..!?! !.?!! !!!!? .?!.? !!!!! .... ....! ?!!...... ..?! .... ...... ..... ..!?! !... ..... ..?! ....... ..... ...!? !!.. ..... .....?!...... ..... ..... ... ..... ..... ....! ?!!.? !!!!! !!!!! !!!!? .?!.? !!!!! !!!!! !!!!! !!!!! !!!!! .... ..... ...!? !!.. ..... .....?!...... ........ ..... ..!?! !.?!! !!!!! !?.?! .?!!! !!!!..... .... !!!!! !!.. ..... .!?!! .?!!! !!!?. ?!.?! !!!!..... ...!? !!.. ......?!.............. ...!? !!.?! !!!!! ?.?!. ?!!!! !... ..... !?!!..... ...? !... ..... ........ ...!? !!.. ......?!..... ..... ... ..... ...!? !!.?! !!!!! !!?.? !.?!! !...... ....! ?!!.? !!!!! !?.?! .?!!! !!.. ..... ..... ....! ?!!...... ..... .....?!...... ..... ..... ........ ..... ..... .!?!! .?!!! !!!!! !!!!? .?!.? !!!!! !!!!! !!!!! !!!!! !... ..... ..!?! !... ..... ..?! ....... ..... .!?!! .?!!! !!!!! ?.?!. ?!!!.... ..... !?!!. ?!!!! !!?.? !.?!! !!!!! !!.. ..... .!?!! .... .... ?!.. ..... ........ ..!?! !... .....?!...... ..... ........ ..... .!?!! .... ..... ...? !... ..... ..... ........ ..... ...!? !!.?! !!!!! !!!!? .?!.? !!!!! !!!!! !!!...... ....! ?!!.? !!!!! !!!?. ?!.?! !!.. ..... .!?!! .?!!! !!!?. ?!.?! !!!!! !!!...... ..!?! !... .....?!...... .... ...! !!!!! !...... ....! ?!!.? !!!!! !?.?! .?!!! !!.. ..... .!?!! .... .... ?!.. ....... ........ ..... !?!!..... ...? !... ..... ........ ..... ....! ?!!.? !!!!! !!!!! !!?.? !.?!! !!!!! !!!!! !!!!! !!!!! !.!!! !!!!..... ..... ..!?! !... ..... .... ?!.. ..... ..... .......... ..... ..... ..!?! !... ..... ......?!..... ..... ..... ..... ........ ..... ..... ...!? !!.?! !!!!! !!!!! !!!?. ?!.?! !!!!! !!!!! !!!!! !!!!! .... ....! ?!!...... ..?! .... ........ ..... ..!?! !... ..... ..?! ....... ..... .!?!! .?!!! !!!!! ?.?!. ?!!!! !!!.... ..... .!?!! .?!!! !!!?. ?!.?! !!!!..... ...!? !!.. ......?!........ ..... ..!?! !... ..... ..?! ....... ..... ...!? !!.. ..... .....?!...... ..... ..... ... ..... ..... !?!!. ?!!!! !!!!! !?.?! .?!!! !!!!! !!!!! .... ..... .!?!! .?!!! !!!!! ?.?!. ?!!!! !!!...... ..!?! !.?!! !!!!? .?!.? !!!!! .... ....! ?!!...... ..?! .... ....... ........ ...!? !!.. ......?!..... ..... ... ..... ..... !?!!. ?!!!! !!!!! !?.?! .?!!! !!!!..... ...!? !!.. ......?!.......... ..... ..... ..!?! !... ..... ......?!..... ..... ..... ..... ........ ..... ..... ...!? !!.?! !!!!! !!!!! !!!?. ?!.?! !!!!! !!!!! !!!!! !!!!! .... ....! ?!!...... ..?! .... ........ ..... ..!?! !... ..... ..?! ....... ..... .!?!! .?!!! !!!!! ?.?!. ?!!!........ ..!?! !.?!! !!!!? .?!.? !!!!! !!!!..... ...!? !!.. ......?!..... ........ ....! ?!!...... ..?! .... ..... ........ ..... ...!? !!.. ..... .....?!...... ..... ..... ... ..... ..... !?!!. ?!!!! !!!!! !?.?! .?!!! !!!!! !!!!! .... ..... .!?!! .?!!! !!!!! ?.?!. ?!!!..... ...!? !!.?! !!!!! ?.?!. ?!!!! !!!!! .... ....! ?!!...... ..?! .... .............. ...!? !!.?! !!!!! ?.?!. ?!!!! !!!!! .... ....! ?!!...... ..?! .... ..... ........ ..!?! !... .....?!...... ........ ..... ..!?! !.?!! !!!!! !?.?! .?!!! ....... ...!? !!.?! !!!!! ?.?!. ?!!!! !... ..... !?!!..... ...? !... .......... ..... ....! ?!!...... ..... ...? !... ..... ..... ..... ..... ........ ..... ..... !?!!. ?!!!! !!!!! !!!!! ?.?!. ?!!!! !!!!! !!!!! !!!!! !!.. ..... .!?!! .... .... ?!.. ..... ........ ....! ?!!...... .... ?!.. ... ..... ...!? !!.?! !!!!! !!?.? !.?!! !...... ....! ?!!.? !!!!! !?.?! .?!!! !!!!! !... ..... !?!!..... ...? !... ..... .......... ..!?! !... .....?!...... ..... ........ ..... ...!? !!.?! !!!!! !!!!! !?.?! .?!!! !!!!! !!!!! !!!!! !!!!! .!!!! !!!...... ..... ..... ....! ?!!...... ..... ..... .... ?!.. ........ ..... ..!?! !.?!! !!!!! !!!?. ?!.?! !!!!! !!!!! !!.. ..... ...!? !!.?! !!!!! !!?.? !.?!! !....!!!! !!!...... ..!?! !.?!! !!!!? .?!.? !!!!! .... ....! ?!!...... ..?! .... .... .....!!!........ ..!?! !.?!! !!!!? .?!.? !!!!! !!!!..... ...!? !!.. ......?!..... ............... ..!?! !... .....?!...... ........ ..... ....! ?!!.? !!!!! !!!!! ?.?!. ?!!!! !!!...... ..!?! !... .....?!............... ..!?! !.?!! !!!!? .?!.? !!!!! .... ....! ?!!...... ..?! .... ....... ..... ....! ?!!...... ..... ...? !... ..... ..... ..... ..... ........ ..... ...!? !!.?! !!!!! !!!!! !?.?! .?!!! !!!!! !!!!! !!!!! !!!...... ....! ?!!...... .... ?!.. ... ..... ..... !?!!. ?!!!! !!!!! !?.?! .?!!! !!!!! !!!...... ..!?! !... .....?!............... ..!?! !.?!! !!!!? .?!.? !!!!! .... ....! ?!!...... ..?! .... ....... ..... !?!!..... .....?!......... ..... .!?!! .... ..... ...? !... ..... ..... ........ ..... ...!? !!.?! !!!!! !!!!? .?!.? !!!!! !!!!! !!!...... ..... .!?!! .?!!! !!!!! !!?.? !.?!! !!!!! !!!!..... ...!? !!.. ......?!..... ..... ..!! !!!!! ..... ....!!!..... ...!? !!.?! !!!!! ?.?!. ?!!!! !!!!! .... ....! ?!!...... ..?! .... ..... ...! !!!!! !.... ........ ...!? !!.. ......?!..... ..... ... ..... ...!? !!.?! !!!!! !!?.? !.?!! !... ..... !?!!. ?!!!! !!?.? !.?!! !!!...... ..!?! !... .....?!............... ..!?! !.?!! !!!!? .?!.? !!!!! .... ..... ..... ..!?! !... ..... ..... ...? !... ..... ..... ..... ........ ..... ....! ?!!.? !!!!! !!!!! !!?.? !.?!! !!!!! !!!!! !!!!! !!!!..... ..... !?!!..... .....?!......... ....! ?!!.? !!!!! !!!?. ?!.?! !!...... ...!? !!.?! !!!!! ?.?!. ?!!!! !!!!! .... ....! ?!!...... ..?! .... .......... ..... .!?!! .... .... ?!.. ..... ..... ... ..... ..... ..!?! !.?!! !!!!! !!!!! ?.?!. ?!!!! !!!!! !!!!! !!!!! !!!!. !!!!! !!.. ..... ..... ..... ...!? !!.. ..... ..... ..... ...? !... ........ ..... .!?!! .?!!! !!!!! !!?.? !.?!! !!!!! !!!!! !... ..... ..!?! !.?!! !!!!! !?.?! .?!!! ....... ...!? !!.?! !!!!! ?.?!. ?!!!! !!!!! .... ....! ?!!...... ..?! .... .............. ...!? !!.?! !!!!! ?.?!. ?!!!! !!!!! .... ....! ?!!...... ..?! .... ..... ...! !!.. ....... ....! ?!!.? !!!!! !?.?! .?!!! !!!!! !!!...... ..!?! !... .....?!.......... ........ ..!?! !... .....?!...... ........ ..... ..!?! !.?!! !!!!! !?.?! .?!!! ... ..... .!?!! .?!!! !!!?. ?!.?! !!!!..... ...!? !!.. ......?!.............. ...!? !!.?! !!!!! ?.?!. ?!!!! !... ..... ..... ...!? !!.. ..... ..... .... ?!.. ..... ..... ..... ........ ..... ..... !?!!. ?!!!! !!!!! !!!?. ?!.?! !!!!! !!!!! !!!!! !!!!! .... ..... .!?!! .... ......?!........ ..... !?!!. ?!!!! !!!!? .?!.? !!!!! !!...... ...!? !!.?! !!!!! ?.?!. ?!!!! !... ..... !?!!..... ...? !... ......... ..... !?!!. ?!!!! !!?.? !.?!! !!!...... ..... .!?!! .... ..... ...? !... ........ ..... ...!? !!.. ..... .....?!...... ..... ..... ... ..... ..... !?!!. ?!!!! !!!!! !?.?! .?!!! !!!!! !!!!! .... ..... .!?!! .?!!! !!!!! ?.?!. ?!.. ..... .!?!! .... .... ?!.. ..... ........ ..... ...!? !!.?! !!!!! !!!!? .?!.? !!!!! !!.. ..... .!?!! .... .... ?!.. ......... ..... .!?!! .?!!! !!!?. ?!.?! !!!!..... ...!? !!.. ......?!........ ..... ..... .!?!! .... ..... .....?!...... ..... ..... ..... ........ ..... ..... !?!!. ?!!!! !!!!! !!!?. ?!.?! !!!!! !!!!! !!!!! !!!!! .... ..... .!?!! .... ......?!........ ..... !?!!. ?!!!! !!!!? .?!.? !!!...... ..!?! !.?!! !!!!? .?!.? !!!!! !!!!..... ...!? !!.. ......?!..... .............. ..!?! !.?!! !!!!? .?!.? !!!!! !!!!..... ..... ..!?! !... ..... .... ?!.. ........ ..... ....! ?!!...... ......?!..... ..... ..... ........ ..... .!?!! .?!!! !!!!! !!?.? !.?!! !!!!! !!!!! !... ..... ..!?! !.?!! !!!!! !?.?! .?!!! ... ..... ..... !?!!. ?!!!! !!!!! !?.?! .?!!! !!!!! !!!!! !!.!! !!!!! .... ..... ...!? !!.. ..... .....?!...... ..... ..... .............. ...!? !!.?! !!!!! ?.?!. ?!!!! !!!!! .... ....! ?!!...... ..?! .... ........ ... ..... .!?!! .... .... ?!.. ..... ........ ..... .!?!! .?!!! !!!!! ?.?!. ?!!!..... ...!? !!.?! !!!!! ?.?!. ?!!!! !... ..... !?!!..... ...? !... ......... ..... !?!!. ?!!!! !!?.? !.?!! !!!...... ..... ..... !?!!..... ..... ......?!..... ..... ..... ..... ... ..... ..... ..!?! !.?!! !!!!! !!!!! ?.?!. ?!!!! !!!!! !!!!! !!!!! !!.. ..... ...!? !!.. ..... ...? !...... ..... ..!?! !.?!! !!!!! !?.?! .?!!! !!!!.... ..... !?!!. ?!!!! !!?.? !.?!! !!!...... ..!?! !... .....?!........... ..... ..!?! !... ..... ..?! ....... ..... ...!? !!.?! !!!!! !!!!? .?!.? !!!!! !!.. ..... ..... ....! ?!!...... ..... .....?!...... ..... ..... ..... ........ ..... ...!? !!.?! !!!!! !!!!? .?!.? !!!!! !!!!! !!!...... ....! ?!!.? !!!!! !!!?. ?!.?! !!!!! !...... ....! ?!!.? !!!!! !?.?! .?!!! !!.. ..... .!?!! .... .... ?!.. .... ..... ... ..... .!?!! .... .... ?!.. ..... ........ ..... .!?!! .?!!! !!!!! ?.?!. ?!!!.... ..... !?!!. ?!!!! !!?.? !.?!! !!!...... ..!?! !... .....?!........... ..... ..... .!?!! .... ..... .....?!...... ..... ..... ..... ........ ..... ..... ..!?! !.?!! !!!!! !!!!! !!?.? !.?!! !!!!! !!!!! !!!!! !!!!..... ...!? !!.. ......?!..... ........ ..... .!?!! .... ......?!........ ..... !?!!. ?!!!! !!!!? .?!.? !!!.... ..... .!?!! .?!!! !!!?. ?!.?! !!!!! !!!...... ..!?! !... .....?!...... ........... ..!?! !... .....?!...... ..... ........ ..... .!?!! .... ..... ...? !... ..... ..... ........ ..... ..... ..!?! !.?!! !!!!! !!!!! !!?.? !.?!! !!!!! !!!!! !!!!! !!!!! !!!...... ..... .!?!! .... ..... ...? !... ..... ........ ..... !?!!. ?!!!! !!!!? .?!.? !!!........ ...!? !!.?! !!!!! ?.?!. ?!!!! !!!!! .... ....! ?!!...... ..?! .... .............. ..... ..!?! !.?!! !!!!! !!!?. ?!.?! !!!!! !!!!! !!!!. !!!!! !!.. ..... ..... !?!!..... ..... ..?! .... ..... ..... ..... ........... ...!? !!.. ......?!..... ..... ... ..... ...!? !!.?! !!!!! !!?.? !.?!! !... ..... !?!!. ?!!!! !!?.? !.?!! !!!...... ..!?! !... .....?!............... ..!?! !.?!! !!!!? .?!.? !!!!! .... ....! ?!!...... ..?! .... ... ..... ..... ..!?! !... ..... ......?!..... ..... ..... ..... ........ ..... ..... .!?!! .?!!! !!!!! !!!!? .?!.? !!!!! !!!!! !!!!! !!!!! !... ..... ..!?! !... ..... ..?! ....... ..... .!?!! .?!!! !!!!! ?.?!. ?!!!! !!!...... ..!?! !.?!! !!!!? .?!.? !!!!! .... ....! ?!!...... ..?! .... ......... ....! ?!!.? !!!!! !?.?! .?!!! !!.. ..... .!?!! .... .... ?!.. ........ ..... !?!!..... .....?!......... ..... .!?!! .... ..... ...? !... ..... ..... ........ ..... ...!? !!.?! !!!!! !!!!? .?!.? !!!!! !!!!! !!!...... ....! ?!!.? !!!!! !!!?. ?!.?! !!!!! !... ..... !?!!. ?!!!! !!?.? !.?!! !!!...... ..!?! !... .....?!.......... ...! !!..... ..... !?!!. ?!!!! !!?.? !.?!! !!!!! !!.. ..... .!?!! .... .... ?!.. ..... .....!!!! !!!...... ........ ..!?! !... .....?!...... ........ ..... ....! ?!!.? !!!!! !!!!! ?.?!. ?!!!! !!!...... ..!?! !... .....?!............... ..!?! !.?!! !!!!? .?!.? !!!!! .... ....! ?!!...... ..?! .... ....... ..... ....! ?!!...... ..... ...? !... ..... ..... ..... ..... ........ ..... ...!? !!.?! !!!!! !!!!! !?.?! .?!!! !!!!! !!!!! !!!!! !!!...... ....! ?!!...... .... ?!.. ... ..... ..... !?!!. ?!!!! !!!!! !?.?! .?!!! !!!!! !!!...... ..!?! !... .....?!...... ......... ..... .!?!! .?!!! !!!?. ?!.?! !!!!! !!!...... ..!?! !... .....?!...... ....... ..... !?!!..... ...? !... ..... ........ ..... ....! ?!!...... ......?!..... ..... ..... ........ ..... .!?!! .?!!! !!!!! !!?.? !.?!! !!!!! !!!!! !... ..... ....! ?!!.? !!!!! !!!!! ?.?!. ?!!!! !!!!! !!.. ..... .!?!! .... .... ?!.. ..... ........... ...!? !!.. ......?!..... ..... ... ..... ...!? !!.?! !!!!! !!?.? !.?!! !... ..... ....! ?!!.? !!!!! !!!!! ?.?!. ?!!!! !!!!! !!.!! !!!!! .... ..... ...!? !!.. ..... .....?!...... ..... ..... ......... ....! ?!!.? !!!!! !?.?! .?!!! !!.. ..... ..... ....! ?!!...... ..... .....?!...... ..... ..... ........ ..... ..... .!?!! .?!!! !!!!! !!!!? .?!.? !!!!! !!!!! !!!!! !!!!! !... ..... ..!?! !... ..... ..?! ....... ..... .!?!! .?!!! !!!!! ?.?!. ?!!!! !!!..... ....! ?!!.? !!!!! !?.?! .?!!! !!.. ..... .!?!! .... .... ?!.. .......... ..... .!?!! .... ......?!........ ..... ..!?! !.?!! !!!!! !!!?. ?!.?! !!!!! !... ..... ..... ...!? !!.. ..... ..... .... ?!.. ..... ..... ..... ..... ........ ..... ..!?! !.?!! !!!!! !!!?. ?!.?! !!!!! !!!!! !!.. ..... ...!? !!.?! !!!!! !!?.? !.?!! !!!!! ....... ...!? !!.?! !!!!! ?.?!. ?!!!! !... ..... !?!!..... ...? !... ......... ..... !?!!. ?!!!! !!?.? !.?!! !!!...... ..!?! !... .....?!............ ........ ...!? !!.?! !!!!! ?.?!. ?!!!! !!!!! !!.. ..... ..... !?!!..... ..... ..?! .... ........ ..... !?!!. ?!!!! !!!!? .?!.? !!!........ ...!? !!.?! !!!!! ?.?!. ?!!!! !... ..... !?!!..... ...? !... ....... ..... ..... !?!!..... ..... .... ?!.. ..... ..... ..... ..... ........ ..... ....! ?!!.? !!!!! !!!!! !!?.? !.?!! !!!!! !!!!! !!!!! !!!!..... ..... !?!!..... .....?!......... ..... .!?!! .?!!! !!!!! !!?.? !.?!! !!!!! !!!!..... ...!? !!.. ......?!..... .............. ..!?! !.?!! !!!!? .?!.? !!!!! !!!!..... ...!? !!.. ......?!..... ........ ....! ?!!...... ..?! .... ..... ........ ..... ...!? !!.. ..... .....?!...... ..... ..... ... ..... ..... !?!!. ?!!!! !!!!! !?.?! .?!!! !!!!! !!!!! .... ..... .!?!! .?!!! !!!!! ?.?!. ?!!!..... ...!? !!.?! !!!!! ?.?!. ?!!!! !!!!! .... ....! ?!!...... ..?! .... .............. ...!? !!.?! !!!!! ?.?!. ?!!!! !!!!! .... ....! ?!!...... ..?! .... ..... ........ ..!?! !... .....?!...... ........ ..... ..!?! !.?!! !!!!! !?.?! .?!!! ....... ..... ..!?! !.?!! !!!!! !!!?. ?!.?! !!!!! !!!!! .!!!! !!!...... ..... .!?!! .... ..... ...? !... ..... ..... ........... ..... ....! ?!!...... ..... ...? !... ..... ..... ..... ..... ........ ..... ...!? !!.?! !!!!! !!!!! !?.?! .?!!! !!!!! !!!!! !!!!! !!!...... ..!?! !.?!! !!!!? .?!.? !!!!! !!!!..... ..... ..!?! !... ..... .... ?!.. ..... ........ ..... .!?!! .?!!! !!!!! ?.?!. ?!!!! !!!........ ...!? !!.?! !!!!! ?.?!. ?!!!! !... ..... !?!!..... ...? !... ....... ..... .!?!! .... ......?!........ ..... ..!?! !... ..... .... ?!.. ..... ..... ........ ..... ....! ?!!.? !!!!! !!!!! ?.?!. ?!!!! !!!!! !!!!..... ..... ..!?! !.?!! !!!!! !!!?. ?!.?! !!!!! !!!!! .... ....! ?!!...... ..?! .... ......... ....! ?!!.? !!!!! !?.?! .?!!! !!.. ..... .!?!! .... .... ?!.. ......... ..... .!?!! .?!!! !!!?. ?!.?! !!!!..... ...!? !!.. ......?!......... ........ ...!? !!.. ......?!..... ..... ... ..... ...!? !!.?! !!!!! !!?.? !.?!! !....... ..!?! !.?!! !!!!? .?!.? !!!!! .... ....! ?!!...... ..?! .... .......... ..... ...!? !!.. ..... ..... ..?! .... ..... ..... ..... ..... ... ..... ..... ....! ?!!.? !!!!! !!!!! !!!!? .?!.? !!!!! !!!!! !!!!! !!!!! !... ..... !?!!..... ...? !... ..... ... ..... ...!? !!.. ..... ...? !...... ..... ..!?! !.?!! !!!!! !?.?! .?!!! ....... ...!? !!.?! !!!!! ?.?!. ?!!!! !!!!! .... ....! ?!!...... ..?! .... ........... ....! ?!!...... ..?! .... ..... ........ ..... ...!? !!.. ..... .....?!...... ..... ..... ... ..... ..... ....! ?!!.? !!!!! !!!!! !!!!? .?!.? !!!!! !!!!! !!!!! !!!!! !!!!! .... ..... ...!? !!.. ..... .....?!...... ........ ..... ..!?! !.?!! !!!!! !?.?! .?!!! ...... ..... !?!!. ?!!!! !!?.? !.?!! !!!!! !!.. ..... .!?!! .... .... ?!.. ..... ......... ..... !?!!. ?!!!! !!?.? !.?!! !!!!! !!.. ..... .!?!! .... .... ?!.. ..... .... ..!! !...... ..... ...!? !!.?! !!!!! !!!!? .?!.? !!!!! !!!!! !!!!! .!!!! !!!...... ..... .!?!! .... ..... ...? !... ..... ..... ..... ......... ..... .!?!! .?!!! !!!?. ?!.?! !!!!! !!!...... ..!?! !... .....?!...... ......!!! !!!!....... ....! ?!!.? !!!!! !?.?! .?!!! !!.. ..... .!?!! .... .... ?!.. ........ ........ ...!? !!.. ......?!..... ..... ... ..... ...!? !!.?! !!!!! !!?.? !.?!! !... ..... !?!!. ?!!!! !!?.? !.?!! !!!...... ..!?! !... .....?!............... ..!?! !.?!! !!!!? .?!.? !!!!! .... ..... ..... ..!?! !... ..... ..... ...? !... ..... ..... ..... ........ ..... ....! ?!!.? !!!!! !!!!! !!?.? !.?!! !!!!! !!!!! !!!!! !!!!..... ..... !?!!..... .....?!......... ....! ?!!.? !!!!! !!!?. ?!.?! !!!!! !....... ..!?! !.?!! !!!!? .?!.? !!!!! .... ....! ?!!...... ..?! .... .......... ....! ?!!...... .... ?!.. ... ..... ..... !?!!. ?!!!! !!!!! !?.?! .?!!! !!!!..... ..... ..... .!?!! .... ..... ..... ..?! .... ..... ..... ..... ..... ... ..... ..... !?!!. ?!!!! !!!!! !?.?! .?!!! !!!!! !!!!! .... ..... .!?!! .?!!! !!!!! ?.?!. ?!!!! !!!.... ..... .!?!! .?!!! !!!?. ?!.?! !!!!..... ...!? !!.. ......?!.............. ...!? !!.?! !!!!! ?.?!. ?!!!! !... ..... !?!!..... ...? !... ...... ..... ... ..... .!?!! .?!!! !!!?. ?!.?! !!!!! !!!!! .... ..... ...!? !!.. ..... .....?!...... ... ..... ...!? !!.?! !!!!! !!?.? !.?!! !..... ..... .!?!! .?!!! !!!?. ?!.?! !!!!..... ...!? !!.. ......?!........... ..... ..... !?!!..... ..... .... ?!.. ..... ..... ..... ..... ........ ..... ....! ?!!.? !!!!! !!!!! !!?.? !.?!! !!!!! !!!!! !!!!! !!!!..... ...!? !!.?! !!!!! ?.?!. ?!!!! !!!!! .... ..... ...!? !!.. ..... .....?!...... ........ ..... ..!?! !.?!! !!!!! !?.?! .?!!! ...... ..... ....! ?!!.? !!!!! !!!!! ?.?!. ?!!!! !!!!! !!!!! !.!!! !!!!..... ..... ..!?! !... ..... .... ?!.. ..... ..... ..... ........... ...!? !!.. ......?!..... ..... ........ ..... ..!?! !... ..... .... ?!.. ..... ..... ........ ..... ..... ...!? !!.?! !!!!! !!!!! !!!?. ?!.?! !!!!! !!!!! !!!!! !!!!! !!!!..... ..... ..!?! !... ..... .... ?!.. ..... ........ ..... .!?!! .?!!! !!!!! ?.?!. ?!!!. ...! !!!!! !....... ..!?! !.?!! !!!!? .?!.? !!!!! .... ....! ?!!...... ..?! .... ... ..... ..!! !!!!! ..... ........ ..!?! !.?!! !!!!? .?!.? !!!!! !!!!! !... ..... ....! ?!!...... ......?!..... ........ ....! ?!!.? !!!!! !!!?. ?!.?! !!......... ..!?! !.?!! !!!!? .?!.? !!!!! .... ....! ?!!...... ..?! .... .......... ..... ...!? !!.. ..... ..... ..?! .... ..... ..... ..... ..... ... ..... ..... ....! ?!!.? !!!!! !!!!! !!!!? .?!.? !!!!! !!!!! !!!!! !!!!! !... ..... !?!!..... ...? !... ..... ... ..... ...!? !!.. ..... ...? !...... ..... ..!?! !.?!! !!!!! !?.?! .?!!! !!!!........ ..!?! !.?!! !!!!? .?!.? !!!!! .... ....! ?!!...... ..?! .... ......... ....! ?!!.? !!!!! !?.?! .?!!! !!.. ..... ..... !?!!..... ..... ..?! .... ........ ..... ..!?! !... ..... .... ?!.. ..... ..... ........ ..... ....! ?!!.? !!!!! !!!!! ?.?!. ?!!!! !!!!! !!!!..... ..... !?!!. ?!!!! !!!!? .?!.? !!!!! !!...... ...!? !!.?! !!!!! ?.?!. ?!!!! !... ..... !?!!..... ...? !... ........ ........ ..!?! !... .....?!...... .......
06-24
### 解码Brainfuck变种编码的方法 Brainfuck 是一种极简化的编程语言,通常用于编写编解码程序。它的变种可能在指令集或执行方式上有所改动。要解码一段 Brainfuck 变种编码的字符串,需要明确以下几点: 1. **确定编码规则**:标准 Brainfuck 有八条指令(`>` `<` `+` `-` `[` `]` `.` `,`),但变种可能引入了新的指令或修改了原有指令的行为[^2]。 2. **分析输入数据**:如果存在额外的标记(如 `begin` 和 `end`),这些可能是包尾符,用于指示编码区域的开始和结束[^2]。 3. **使用工具或脚本**:可以通过在线解码工具或自定义脚本实现解码。例如,uuencode 编码可以使用特定工具进行解码[^2]。 以下是基于 Python 的通用解码方法示例: ```python # 示例代码:解码Brainfuck变种编码 def brainfuck_decode(code): memory = [0] pointer = 0 output = [] bracket_map = {} stack = [] # 构建括号映射表 for i, c in enumerate(code): if c == '[': stack.append(i) elif c == ']': start = stack.pop() bracket_map[start] = i bracket_map[i] = start i = 0 while i < len(code): c = code[i] if c == '>': pointer += 1 if pointer >= len(memory): memory.append(0) elif c == '<': pointer = max(0, pointer - 1) elif c == '+': memory[pointer] = (memory[pointer] + 1) % 256 elif c == '-': memory[pointer] = (memory[pointer] - 1) % 256 elif c == '.': output.append(chr(memory[pointer])) elif c == ',': pass # 输入功能在此忽略 elif c == '[' and memory[pointer] == 0: i = bracket_map[i] elif c == ']' and memory[pointer] != 0: i = bracket_map[i] i += 1 return ''.join(output) # 示例解码 code = "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.---------." decoded_string = brainfuck_decode(code) print(decoded_string) ``` 上述代码实现了标准 Brainfuck 的解码逻辑。如果遇到变种,需根据具体规则调整指令集或执行逻辑[^4]。 ### 注意事项 - 如果变种涉及非标准指令,需参考相关文档或上下文信息进行调整。 - 对于复杂变种,建议使用专用工具或逆向工程分析其行为模式[^2]。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值