Program: 54279
Project: 54279
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  checkForOpenPorts();
  mActionListView=(ListView)findViewById(R.id.actionListView);
  mActionAdapter=new ActionAdapter(R.layout.plugin_mitm_list_item,mActions);
  mActionListView.setAdapter(mActionAdapter);
  mImagePicker=new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
  mImagePicker.setType("String_Node_Str");
  mImagePicker.putExtra(Intent.EXTRA_LOCAL_ONLY,true);
  mScriptPicker=new Intent();
  mScriptPicker.addCategory(Intent.CATEGORY_OPENABLE);
  mScriptPicker.setType("String_Node_Str");
  mScriptPicker.setAction(Intent.ACTION_GET_CONTENT);
  mScriptPicker.putExtra(Intent.EXTRA_LOCAL_ONLY,true);
  mActions.add(new Action("String_Node_Str","String_Node_Str",R.drawable.action_sniffer_48,new OnClickListener(){
    @Override public void onClick(    View v){
      setStoppedState();
      startActivity(new Intent(MITM.this,Sniffer.class));
      overridePendingTransition(R.anim.slide_in_left,R.anim.slide_out_left);
    }
  }
));
  mActions.add(new Action("String_Node_Str","String_Node_Str",R.drawable.action_passwords_48,new OnClickListener(){
    @Override public void onClick(    View v){
      setStoppedState();
      startActivity(new Intent(MITM.this,PasswordSniffer.class));
      overridePendingTransition(R.anim.slide_in_left,R.anim.slide_out_left);
    }
  }
));
  mActions.add(new Action("String_Node_Str","String_Node_Str",R.drawable.action_hijack_48,new OnClickListener(){
    @Override public void onClick(    View v){
      setStoppedState();
      startActivity(new Intent(MITM.this,Hijacker.class));
      overridePendingTransition(R.anim.slide_in_left,R.anim.slide_out_left);
    }
  }
));
  mActions.add(new Action("String_Node_Str","String_Node_Str",R.drawable.action_kill_48,new OnClickListener(){
    @Override public void onClick(    View v){
      ProgressBar activity=(ProgressBar)v.findViewById(R.id.itemActivity);
      if (activity.getVisibility() == View.INVISIBLE) {
        if (System.getCurrentTarget().getType() != Target.Type.ENDPOINT)         new ErrorDialog("String_Node_Str","String_Node_Str",MITM.this).show();
 else {
          setStoppedState();
          activity.setVisibility(View.VISIBLE);
          Toast.makeText(MITM.this,"String_Node_Str",Toast.LENGTH_LONG).show();
          ConnectionKiller.start();
        }
      }
 else {
        ConnectionKiller.stop();
        activity.setVisibility(View.INVISIBLE);
      }
    }
  }
));
  mActions.add(new Action("String_Node_Str","String_Node_Str",R.drawable.action_redirect_48,new OnClickListener(){
    @Override public void onClick(    View v){
      final ProgressBar activity=(ProgressBar)v.findViewById(R.id.itemActivity);
      if (activity.getVisibility() == View.INVISIBLE) {
        setStoppedState();
        new RedirectionDialog("String_Node_Str",MITM.this,new RedirectionDialogListener(){
          @Override public void onInputEntered(          String address,          String port){
            if (address.isEmpty() == false && port.isEmpty() == false) {
              try {
                int iport=Integer.parseInt(port);
                if (iport <= 0 || iport > 65535)                 throw new Exception("String_Node_Str");
                address=address.startsWith("String_Node_Str") ? address : "String_Node_Str" + address;
                URL url=new URL(address);
                address=url.getHost();
                activity.setVisibility(View.VISIBLE);
                Toast.makeText(MITM.this,"String_Node_Str",Toast.LENGTH_LONG).show();
                final String faddress=address;
                final int fport=iport;
                mSpoofSession=new SpoofSession();
                mSpoofSession.start(new OnSessionReadyListener(){
                  @Override public void onSessionReady(){
                    System.getProxy().setRedirection(faddress,fport);
                  }
                }
);
              }
 catch (              Exception e) {
                new ErrorDialog("String_Node_Str",e.getMessage(),MITM.this).show();
              }
            }
 else             new ErrorDialog("String_Node_Str","String_Node_Str",MITM.this).show();
          }
        }
).show();
      }
 else       setStoppedState();
    }
  }
));
  mActions.add(new Action("String_Node_Str","String_Node_Str",R.drawable.action_image_48,new OnClickListener(){
    @Override public void onClick(    View v){
      final ProgressBar activity=(ProgressBar)v.findViewById(R.id.itemActivity);
      if (activity.getVisibility() == View.INVISIBLE) {
        setStoppedState();
        new ChoiceDialog(MITM.this,"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str"},new ChoiceDialogListener(){
          @Override public void onChoice(          int choice){
            if (choice == 0) {
              mCurrentActivity=activity;
              startActivityForResult(mImagePicker,SELECT_PICTURE);
            }
 else {
              new InputDialog("String_Node_Str","String_Node_Str","String_Node_Str",true,false,MITM.this,new InputDialogListener(){
                @Override public void onInputEntered(                String input){
                  String image=input.trim();
                  if (image.isEmpty() == false) {
                    image=image.startsWith("String_Node_Str") ? image : "String_Node_Str" + image;
                    activity.setVisibility(View.VISIBLE);
                    final String resource=image;
                    mSpoofSession=new SpoofSession();
                    mSpoofSession.start(new OnSessionReadyListener(){
                      @Override public void onSessionReady(){
                        System.getProxy().setFilter(new Proxy.ProxyFilter(){
                          @Override public String onDataReceived(                          String headers,                          String data){
                            data=data.replaceAll("String_Node_Str","String_Node_Str" + resource + "String_Node_Str");
                            data=data.replaceAll("String_Node_Str","String_Node_Str" + resource + "String_Node_Str");
                            return data;
                          }
                        }
);
                      }
                    }
);
                    Toast.makeText(MITM.this,"String_Node_Str",Toast.LENGTH_LONG).show();
                  }
 else                   new ErrorDialog("String_Node_Str","String_Node_Str",MITM.this).show();
                }
              }
).show();
            }
          }
        }
).show();
      }
 else {
        mCurrentActivity=null;
        setStoppedState();
      }
    }
  }
));
  mActions.add(new Action("String_Node_Str","String_Node_Str",R.drawable.action_youtube_48,new OnClickListener(){
    @Override public void onClick(    View v){
      final ProgressBar activity=(ProgressBar)v.findViewById(R.id.itemActivity);
      if (activity.getVisibility() == View.INVISIBLE) {
        setStoppedState();
        new InputDialog("String_Node_Str","String_Node_Str","String_Node_Str",true,false,MITM.this,new InputDialogListener(){
          @Override public void onInputEntered(          String input){
            final String video=input.trim();
            Matcher matcher=YOUTUBE_PATTERN.matcher(input);
            if (video.isEmpty() == false && matcher != null && matcher.find()) {
              final String videoId=matcher.group(1);
              activity.setVisibility(View.VISIBLE);
              Toast.makeText(MITM.this,"String_Node_Str",Toast.LENGTH_LONG).show();
              mSpoofSession=new SpoofSession();
              mSpoofSession.start(new OnSessionReadyListener(){
                @Override public void onSessionReady(){
                  System.getProxy().setFilter(new Proxy.ProxyFilter(){
                    @Override public String onDataReceived(                    String headers,                    String data){
                      if (data.matches("String_Node_Str"))                       data=data.replaceAll("String_Node_Str","String_Node_Str" + videoId);
 else                       if (data.matches("String_Node_Str"))                       data=data.replaceAll("String_Node_Str","String_Node_Str" + videoId);
 else                       if (data.matches("String_Node_Str"))                       data=data.replaceAll("String_Node_Str","String_Node_Str" + videoId);
                      return data;
                    }
                  }
);
                }
              }
);
            }
 else             new ErrorDialog("String_Node_Str","String_Node_Str",MITM.this).show();
          }
        }
).show();
      }
 else       setStoppedState();
    }
  }
));
  mActions.add(new Action("String_Node_Str","String_Node_Str",R.drawable.action_injection_48,new OnClickListener(){
    @Override public void onClick(    View v){
      final ProgressBar activity=(ProgressBar)v.findViewById(R.id.itemActivity);
      if (activity.getVisibility() == View.INVISIBLE) {
        setStoppedState();
        new ChoiceDialog(MITM.this,"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str"},new ChoiceDialogListener(){
          @Override public void onChoice(          int choice){
            if (choice == 0) {
              mCurrentActivity=activity;
              startActivityForResult(mScriptPicker,SELECT_SCRIPT);
            }
 else {
              new InputDialog("String_Node_Str","String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str",true,false,MITM.this,new InputDialogListener(){
                @Override public void onInputEntered(                String input){
                  final String js=input.trim();
                  if (js.isEmpty() == false || js.startsWith("String_Node_Str") == false) {
                    activity.setVisibility(View.VISIBLE);
                    Toast.makeText(MITM.this,"String_Node_Str",Toast.LENGTH_LONG).show();
                    mSpoofSession=new SpoofSession();
                    mSpoofSession.start(new OnSessionReadyListener(){
                      @Override public void onSessionReady(){
                        System.getProxy().setFilter(new Proxy.ProxyFilter(){
                          @Override public String onDataReceived(                          String headers,                          String data){
                            return data.replaceAll("String_Node_Str",js + "String_Node_Str");
                          }
                        }
);
                      }
                    }
);
                  }
 else                   new ErrorDialog("String_Node_Str","String_Node_Str",MITM.this).show();
                }
              }
).show();
            }
          }
        }
).show();
      }
 else {
        mCurrentActivity=null;
        setStoppedState();
      }
    }
  }
));
  mActions.add(new Action("String_Node_Str","String_Node_Str",new OnClickListener(){
    @Override public void onClick(    View v){
      final ProgressBar activity=(ProgressBar)v.findViewById(R.id.itemActivity);
      if (activity.getVisibility() == View.INVISIBLE) {
        setStoppedState();
        new CustomFilterDialog("String_Node_Str",MITM.this,new CustomFilterDialogListener(){
          @Override public void onInputEntered(          final ArrayList<String> from,          final ArrayList<String> to){
            if (from.isEmpty() == false && to.isEmpty() == false) {
              try {
                for (                String exp : from) {
                  Pattern.compile(exp);
                }
                activity.setVisibility(View.VISIBLE);
                Toast.makeText(MITM.this,"String_Node_Str",Toast.LENGTH_LONG).show();
                mSpoofSession=new SpoofSession();
                mSpoofSession.start(new OnSessionReadyListener(){
                  @Override public void onSessionReady(){
                    System.getProxy().setFilter(new ProxyFilter(){
                      @Override public String onDataReceived(                      String headers,                      String data){
                        for (int i=0; i < from.size(); i++) {
                          data=data.replaceAll(from.get(i),to.get(i));
                        }
                        return data;
                      }
                    }
);
                  }
                }
);
              }
 catch (              PatternSyntaxException e) {
                new ErrorDialog("String_Node_Str","String_Node_Str" + e.getDescription() + "String_Node_Str",MITM.this).show();
              }
            }
 else             new ErrorDialog("String_Node_Str","String_Node_Str",MITM.this).show();
          }
        }
).show();
      }
 else       setStoppedState();
    }
  }
));
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  checkForOpenPorts();
  mActionListView=(ListView)findViewById(R.id.actionListView);
  mActionAdapter=new ActionAdapter(R.layout.plugin_mitm_list_item,mActions);
  mActionListView.setAdapter(mActionAdapter);
  mImagePicker=new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
  mImagePicker.setType("String_Node_Str");
  mImagePicker.putExtra(Intent.EXTRA_LOCAL_ONLY,true);
  mScriptPicker=new Intent();
  mScriptPicker.addCategory(Intent.CATEGORY_OPENABLE);
  mScriptPicker.setType("String_Node_Str");
  mScriptPicker.setAction(Intent.ACTION_GET_CONTENT);
  mScriptPicker.putExtra(Intent.EXTRA_LOCAL_ONLY,true);
  mActions.add(new Action("String_Node_Str","String_Node_Str",R.drawable.action_sniffer_48,new OnClickListener(){
    @Override public void onClick(    View v){
      setStoppedState();
      startActivity(new Intent(MITM.this,Sniffer.class));
      overridePendingTransition(R.anim.slide_in_left,R.anim.slide_out_left);
    }
  }
));
  mActions.add(new Action("String_Node_Str","String_Node_Str",R.drawable.action_passwords_48,new OnClickListener(){
    @Override public void onClick(    View v){
      setStoppedState();
      startActivity(new Intent(MITM.this,PasswordSniffer.class));
      overridePendingTransition(R.anim.slide_in_left,R.anim.slide_out_left);
    }
  }
));
  mActions.add(new Action("String_Node_Str","String_Node_Str",R.drawable.action_hijack_48,new OnClickListener(){
    @Override public void onClick(    View v){
      setStoppedState();
      startActivity(new Intent(MITM.this,Hijacker.class));
      overridePendingTransition(R.anim.slide_in_left,R.anim.slide_out_left);
    }
  }
));
  mActions.add(new Action("String_Node_Str","String_Node_Str",R.drawable.action_kill_48,new OnClickListener(){
    @Override public void onClick(    View v){
      ProgressBar activity=(ProgressBar)v.findViewById(R.id.itemActivity);
      if (activity.getVisibility() == View.INVISIBLE) {
        if (System.getCurrentTarget().getType() != Target.Type.ENDPOINT)         new ErrorDialog("String_Node_Str","String_Node_Str",MITM.this).show();
 else {
          setStoppedState();
          activity.setVisibility(View.VISIBLE);
          Toast.makeText(MITM.this,"String_Node_Str",Toast.LENGTH_LONG).show();
          ConnectionKiller.start();
        }
      }
 else {
        ConnectionKiller.stop();
        activity.setVisibility(View.INVISIBLE);
      }
    }
  }
));
  mActions.add(new Action("String_Node_Str","String_Node_Str",R.drawable.action_redirect_48,new OnClickListener(){
    @Override public void onClick(    View v){
      final ProgressBar activity=(ProgressBar)v.findViewById(R.id.itemActivity);
      if (activity.getVisibility() == View.INVISIBLE) {
        setStoppedState();
        new RedirectionDialog("String_Node_Str",MITM.this,new RedirectionDialogListener(){
          @Override public void onInputEntered(          String address,          String port){
            if (address.isEmpty() == false && port.isEmpty() == false) {
              try {
                int iport=Integer.parseInt(port);
                if (iport <= 0 || iport > 65535)                 throw new Exception("String_Node_Str");
                address=address.startsWith("String_Node_Str") ? address : "String_Node_Str" + address;
                URL url=new URL(address);
                address=url.getHost();
                activity.setVisibility(View.VISIBLE);
                Toast.makeText(MITM.this,"String_Node_Str",Toast.LENGTH_LONG).show();
                final String faddress=address;
                final int fport=iport;
                mSpoofSession=new SpoofSession();
                mSpoofSession.start(new OnSessionReadyListener(){
                  @Override public void onSessionReady(){
                    System.getProxy().setRedirection(faddress,fport);
                  }
                }
);
              }
 catch (              Exception e) {
                new ErrorDialog("String_Node_Str",e.getMessage(),MITM.this).show();
              }
            }
 else             new ErrorDialog("String_Node_Str","String_Node_Str",MITM.this).show();
          }
        }
).show();
      }
 else       setStoppedState();
    }
  }
));
  mActions.add(new Action("String_Node_Str","String_Node_Str",R.drawable.action_image_48,new OnClickListener(){
    @Override public void onClick(    View v){
      final ProgressBar activity=(ProgressBar)v.findViewById(R.id.itemActivity);
      if (activity.getVisibility() == View.INVISIBLE) {
        setStoppedState();
        new ChoiceDialog(MITM.this,"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str"},new ChoiceDialogListener(){
          @Override public void onChoice(          int choice){
            if (choice == 0) {
              try {
                mCurrentActivity=activity;
                startActivityForResult(mImagePicker,SELECT_PICTURE);
              }
 catch (              ActivityNotFoundException e) {
                new ErrorDialog("String_Node_Str","String_Node_Str",MITM.this).show();
              }
            }
 else {
              new InputDialog("String_Node_Str","String_Node_Str","String_Node_Str",true,false,MITM.this,new InputDialogListener(){
                @Override public void onInputEntered(                String input){
                  String image=input.trim();
                  if (image.isEmpty() == false) {
                    image=image.startsWith("String_Node_Str") ? image : "String_Node_Str" + image;
                    activity.setVisibility(View.VISIBLE);
                    final String resource=image;
                    mSpoofSession=new SpoofSession();
                    mSpoofSession.start(new OnSessionReadyListener(){
                      @Override public void onSessionReady(){
                        System.getProxy().setFilter(new Proxy.ProxyFilter(){
                          @Override public String onDataReceived(                          String headers,                          String data){
                            data=data.replaceAll("String_Node_Str","String_Node_Str" + resource + "String_Node_Str");
                            data=data.replaceAll("String_Node_Str","String_Node_Str" + resource + "String_Node_Str");
                            return data;
                          }
                        }
);
                      }
                    }
);
                    Toast.makeText(MITM.this,"String_Node_Str",Toast.LENGTH_LONG).show();
                  }
 else                   new ErrorDialog("String_Node_Str","String_Node_Str",MITM.this).show();
                }
              }
).show();
            }
          }
        }
).show();
      }
 else {
        mCurrentActivity=null;
        setStoppedState();
      }
    }
  }
));
  mActions.add(new Action("String_Node_Str","String_Node_Str",R.drawable.action_youtube_48,new OnClickListener(){
    @Override public void onClick(    View v){
      final ProgressBar activity=(ProgressBar)v.findViewById(R.id.itemActivity);
      if (activity.getVisibility() == View.INVISIBLE) {
        setStoppedState();
        new InputDialog("String_Node_Str","String_Node_Str","String_Node_Str",true,false,MITM.this,new InputDialogListener(){
          @Override public void onInputEntered(          String input){
            final String video=input.trim();
            Matcher matcher=YOUTUBE_PATTERN.matcher(input);
            if (video.isEmpty() == false && matcher != null && matcher.find()) {
              final String videoId=matcher.group(1);
              activity.setVisibility(View.VISIBLE);
              Toast.makeText(MITM.this,"String_Node_Str",Toast.LENGTH_LONG).show();
              mSpoofSession=new SpoofSession();
              mSpoofSession.start(new OnSessionReadyListener(){
                @Override public void onSessionReady(){
                  System.getProxy().setFilter(new Proxy.ProxyFilter(){
                    @Override public String onDataReceived(                    String headers,                    String data){
                      if (data.matches("String_Node_Str"))                       data=data.replaceAll("String_Node_Str","String_Node_Str" + videoId);
 else                       if (data.matches("String_Node_Str"))                       data=data.replaceAll("String_Node_Str","String_Node_Str" + videoId);
 else                       if (data.matches("String_Node_Str"))                       data=data.replaceAll("String_Node_Str","String_Node_Str" + videoId);
                      return data;
                    }
                  }
);
                }
              }
);
            }
 else             new ErrorDialog("String_Node_Str","String_Node_Str",MITM.this).show();
          }
        }
).show();
      }
 else       setStoppedState();
    }
  }
));
  mActions.add(new Action("String_Node_Str","String_Node_Str",R.drawable.action_injection_48,new OnClickListener(){
    @Override public void onClick(    View v){
      final ProgressBar activity=(ProgressBar)v.findViewById(R.id.itemActivity);
      if (activity.getVisibility() == View.INVISIBLE) {
        setStoppedState();
        new ChoiceDialog(MITM.this,"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str"},new ChoiceDialogListener(){
          @Override public void onChoice(          int choice){
            if (choice == 0) {
              try {
                mCurrentActivity=activity;
                startActivityForResult(mScriptPicker,SELECT_SCRIPT);
              }
 catch (              ActivityNotFoundException e) {
                new ErrorDialog("String_Node_Str","String_Node_Str",MITM.this).show();
              }
            }
 else {
              new InputDialog("String_Node_Str","String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str",true,false,MITM.this,new InputDialogListener(){
                @Override public void onInputEntered(                String input){
                  final String js=input.trim();
                  if (js.isEmpty() == false || js.startsWith("String_Node_Str") == false) {
                    activity.setVisibility(View.VISIBLE);
                    Toast.makeText(MITM.this,"String_Node_Str",Toast.LENGTH_LONG).show();
                    mSpoofSession=new SpoofSession();
                    mSpoofSession.start(new OnSessionReadyListener(){
                      @Override public void onSessionReady(){
                        System.getProxy().setFilter(new Proxy.ProxyFilter(){
                          @Override public String onDataReceived(                          String headers,                          String data){
                            return data.replaceAll("String_Node_Str",js + "String_Node_Str");
                          }
                        }
);
                      }
                    }
);
                  }
 else                   new ErrorDialog("String_Node_Str","String_Node_Str",MITM.this).show();
                }
              }
).show();
            }
          }
        }
).show();
      }
 else {
        mCurrentActivity=null;
        setStoppedState();
      }
    }
  }
));
  mActions.add(new Action("String_Node_Str","String_Node_Str",new OnClickListener(){
    @Override public void onClick(    View v){
      final ProgressBar activity=(ProgressBar)v.findViewById(R.id.itemActivity);
      if (activity.getVisibility() == View.INVISIBLE) {
        setStoppedState();
        new CustomFilterDialog("String_Node_Str",MITM.this,new CustomFilterDialogListener(){
          @Override public void onInputEntered(          final ArrayList<String> from,          final ArrayList<String> to){
            if (from.isEmpty() == false && to.isEmpty() == false) {
              try {
                for (                String exp : from) {
                  Pattern.compile(exp);
                }
                activity.setVisibility(View.VISIBLE);
                Toast.makeText(MITM.this,"String_Node_Str",Toast.LENGTH_LONG).show();
                mSpoofSession=new SpoofSession();
                mSpoofSession.start(new OnSessionReadyListener(){
                  @Override public void onSessionReady(){
                    System.getProxy().setFilter(new ProxyFilter(){
                      @Override public String onDataReceived(                      String headers,                      String data){
                        for (int i=0; i < from.size(); i++) {
                          data=data.replaceAll(from.get(i),to.get(i));
                        }
                        return data;
                      }
                    }
);
                  }
                }
);
              }
 catch (              PatternSyntaxException e) {
                new ErrorDialog("String_Node_Str","String_Node_Str" + e.getDescription() + "String_Node_Str",MITM.this).show();
              }
            }
 else             new ErrorDialog("String_Node_Str","String_Node_Str",MITM.this).show();
          }
        }
).show();
      }
 else       setStoppedState();
    }
  }
));
}