2014-03-06 1 views
1

그래서 나는 내가 굉장한 해부학 자라 부를 수있는 것을 썼다. 별로 효과적이지는 않지만 업무 능률이 크게 향상됩니다.어떻게하면 wireshark를 닫을 때 wireshark 루아 디시 터 프로토콜 환경 설정을 저장하고 유지할 수 있습니까?

내 유일한 문제는 내가 몇 가지 환경 설정을 공개하고 wireshark close/start를 계속 사용하지 않는다는 것입니다.

I.E. :

전제 조건 : 루아 스크립트 더 ... 플러그인 디렉토리해야

  1. 열기 와이어 샤크, 편집> 환경 설정> 프로토콜> http.queryparameters ...
  2. 설정 Param1을 값을 "AAA", 클릭 승인. (적절하게 해부학에 영향을 미칩니다.)
  3. wireshark를 닫고, 다시 시작합니다. 다시 그 값이 달라집니다.

내 해부학자 :

-- Written by Eitam Doodai 
-- trivial postdissector example 
-- declare some Fields to be read 
full_uri_from_request = Field.new("http.request.full_uri") 

-- declare our (pseudo) protocol 
http_query_params_proto = Proto("http.query_parameters","HTTP Query Parameters Postdissector") 

-- create the fields for our "protocol" 
query_param1 = ProtoField.string("http.query_parameters.param1","PARAM1") 
query_param2 = ProtoField.string("http.query_parameters.param2","PARAM2") 
query_param3 = ProtoField.string("http.query_parameters.param3","PARAM3") 

-- add the field to the protocol 
http_query_params_proto.fields = {query_param1} 
http_query_params_proto.fields = {query_param2} 
http_query_params_proto.fields = {query_param3} 

-- Add prefs 
local p1 = http_query_params_proto.prefs 
p1.value1 = Pref.string ("Param1 Value", "123", "Param key to extract") 
p1.value2 = Pref.string ("Param2 Value", "456", "Param key to extract") 
p1.value3 = Pref.string ("Param3 Value", "789", "Param key to extract") 

-- create a function to "postdissect" each frame 
function http_query_params_proto.dissector(buffer,pinfo,tree) 
     -- obtain the current values the protocol fields 
     local full_uri_value = full_uri_from_request() 
     if full_uri_value then 
       local value = tostring(full_uri_value) 
       local subtree = tree:add(http_query_params_proto,"Query Param1") 
       local subtree = tree:add(http_query_params_proto,"Query Param2") 
       local subtree = tree:add(http_query_params_proto,"Query Param3") 
       _, _, query_param1_str = string.find(value,p1.value1 .. "=([^&]+)") 
       _, _, query_param2_str = string.find(value,p1.value2 .. "=([^&]+)") 
       _, _, query_param3_str = string.find(value,p1.value3 .. "=([^&]+)") 
       if query_param1_str then 
         subtree:add(query_param1,query_param1_str) 
       end 

       if query_param2_str then 
         subtree:add(query_param2,query_param2_str) 
       end 
       if query_param3_str then 
         subtree:add(query_param3,query_param3_str) 
       end 
     end 
end 

-- register our protocol as a postdissector 
register_postdissector(http_query_params_proto) 

답변

3

당신은 열려있는 콘솔을 가지고, 당신이 그것을 당신이 당신의 http.query_parameters.param 설정 중 하나를 변경 한 후, 명령 줄에서 Wireshark를 시작 그것을 닫습니다 와이어 샤크를 저장하고 다시 시작하면 '같은 것을 볼 것이다 :

...preferences line 1829: No such preference "http.query_parameters.value2" (applying your preferences once should remove this warning) 

을 그리고 그 문제의 : 외부 환경에 대해 그것이 알고-에 대한/이해하지 못하는 저장된 환경 설정 파일에서 찾은 Wireshark를 인쇄합니다.

편집 : 이것에 대한 버그를 열지 마십시오. 문제는 환경 설정과 함께 이미 존재하는 프로토콜 이름 "http"을 사용하는 것입니다. 즉, 기본적으로 환경 설정을 http.query...으로 지정 했으므로 wireshark는 http 프로토콜 모듈에 속해야한다고 생각하지만 실제http 모듈은 그것에 대해 아무것도 모르기 때문에 wireshark는 다음에 시도 할 때 해당 오류를 인쇄합니다 환경 설정 파일에서 읽는 중.

짧은 이야기 : 실제 프로토콜 이름과 충돌하지 않도록 Proto 및 필드의 이름 등을 변경하십시오.

+0

소중한 질문을 한 후에도 계속 노력하고 포기하려고했습니다. 당신이 정말로 나를 도왔습니다. (나는이 주석이 SO 수준에서는 쓸모 없다는 것을 알고 있지만, 인간으로서 나는 기울어 져있다.) – eitama

관련 문제