python - how to find strings within two markers -
i using python text processing.basically want extract contents between 2 landmarks. specific contents following. how can design regular expression text between "find intent vulnerabilities" , "print intent summary". thanks
find component vulnerabilities ****************************************************************************************** !!!@methods_for_class[org.apache.cordova.batterylistener$1*org/apache/cordova/batterylistener/execute(ljava/lang/string;lorg/json/jsonarray;lorg/apache/cordova/api/callbackcontext;)@70!] nil !!!@methods_for_class[org.apache.cordova.cordovawebview$1*org/apache/cordova/cordovawebview/setup()@124!] nil !!!@methods_for_class[org.apache.cordova.networkmanager$1*org/apache/cordova/networkmanager/initialize(lorg/apache/cordova/api/cordovainterface;lorg/apache/cordova/cordovawebview;)@57!] nil !!!@methods_for_class[org.apache.cordova.device$1*org/apache/cordova/device/inittelephonyreceiver()@29!] nil protected receiver: org.apache.cordova.batterylistener$1*org/apache/cordova/batterylistener/execute(ljava/lang/string;lorg/json/jsonarray;lorg/apache/cordova/api/callbackcontext;)@70!, 0 protected receiver: org.apache.cordova.cordovawebview$1*org/apache/cordova/cordovawebview/setup()@124!, 0 possible malicious broadcast injection: org.apache.cordova.networkmanager$1*org/apache/cordova/networkmanager/initialize(lorg/apache/cordova/api/cordovainterface;lorg/apache/cordova/cordovawebview;)@57, 0 possible malicious broadcast injection: org.apache.cordova.device$1*org/apache/cordova/device/inittelephonyreceiver()@29, 0 find intent vulnerabilities ****************************************************************************************** possible activity hijacking: org/apache/cordova/cordovawebview/showwebpage(ljava/lang/string;zzljava/util/hashmap;)@147, source line: 664, hasextras=false, hasread=false, haswrite=false possible activity hijacking: org/apache/cordova/cordovawebview/showwebpage(ljava/lang/string;zzljava/util/hashmap;)@201, source line: 676, hasextras=false, hasread=false, haswrite=false possible activity hijacking: org/apache/cordova/cordovawebviewclient/shouldoverrideurlloading(landroid/webkit/webview;ljava/lang/string;)@83, source line: 131, hasextras=false, hasread=false, haswrite=false possible activity hijacking: org/apache/cordova/cordovawebviewclient/shouldoverrideurlloading(landroid/webkit/webview;ljava/lang/string;)@161, source line: 142, hasextras=false, hasread=false, haswrite=false possible activity hijacking: org/apache/cordova/cordovawebviewclient/shouldoverrideurlloading(landroid/webkit/webview;ljava/lang/string;)@239, source line: 153, hasextras=false, hasread=false, haswrite=false possible activity hijacking: org/apache/cordova/cordovawebviewclient/shouldoverrideurlloading(landroid/webkit/webview;ljava/lang/string;)@368, source line: 185, hasextras=true, hasread=false, haswrite=false possible activity hijacking: org/apache/cordova/cordovawebviewclient/shouldoverrideurlloading(landroid/webkit/webview;ljava/lang/string;)@544, source line: 209, hasextras=false, hasread=false, haswrite=false possible service hijacking: org/apache/cordova/api/legacycontext/bindservice(landroid/content/intent;landroid/content/serviceconnection;i)@22, source line: 142, hasextras=false, hasread=false, haswrite=false possible activity hijacking: org/apache/cordova/api/legacycontext/startactivity(landroid/content/intent;)@20, source line: 82, hasextras=false, hasread=false, haswrite=false possible service hijacking: org/apache/cordova/api/legacycontext/startservice(landroid/content/intent;)@20, source line: 136, hasextras=false, hasread=false, haswrite=false print intent summary ****************************************************************************************** ************************** org/apache/cordova/capture/captureaudio()@8 invoke-direct {v0,v1},android/content/intent/<init> ; <init>(ljava/lang/string;)v explicit: false destination type: done: false **************************
do need use regex? it's simpler use str.find or str.index find each marker , use slicing extract what's between them.
however, using regex:
re.search(r"(?s)find intent vulnerabilities\n(.*?)print intent summary\n", text).group(1)
Comments
Post a Comment