<div dir="ltr">Ohhh, yeah! Of course! Thank you! :)</div><div class="gmail_extra"><br><div class="gmail_quote">On 24 April 2016 at 21:54, Leek, Timothy - 0559 - MITLL <span dir="ltr">&lt;<a href="mailto:tleek@ll.mit.edu" target="_blank">tleek@ll.mit.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif"><div>Jumping in.  nt_user_create_window_ex is a pointer.  So it doesn’t need (or get) a has_.  Its NULL if it is absent and a valid pointer otherwise.  </div><div><br></div><span><div style="font-family:Calibri;font-size:11pt;text-align:left;color:black;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;BORDER-TOP:#b5c4df 1pt solid;BORDER-RIGHT:medium none;PADDING-TOP:3pt"><span style="font-weight:bold">From: </span> &lt;<a href="mailto:panda-users-bounces@mit.edu" target="_blank">panda-users-bounces@mit.edu</a>&gt; on behalf of Bridgey theGeek &lt;<a href="mailto:bridgeythegeek@gmail.com" target="_blank">bridgeythegeek@gmail.com</a>&gt;<br><span style="font-weight:bold">Date: </span> Sunday, April 24, 2016 at 3:18 PM<br><span style="font-weight:bold">To: </span> Brendan Dolan-Gavitt &lt;<a href="mailto:brendandg@nyu.edu" target="_blank">brendandg@nyu.edu</a>&gt;<br><span style="font-weight:bold">Cc: </span> &quot;<a href="mailto:panda-users@mit.edu" target="_blank">panda-users@mit.edu</a>&quot; &lt;<a href="mailto:panda-users@mit.edu" target="_blank">panda-users@mit.edu</a>&gt;<br><span style="font-weight:bold">Subject: </span> Re: [panda-users] Logging a new message in win7proc<br></div><div><br></div><div><div><div dir="ltr">Thanks Brendan - that&#39;s a great help!
<div><br></div><div>I have some progress. I&#39;ve added the following to win7proc.proto:</div><div><div>message UserCreateWindowEx {</div><div><span style="white-space:pre-wrap"></span>required Process proc = 1;</div><div><span style="white-space:pre-wrap"></span>required uint32 id = 2;</div><div>}</div><div>optional UserCreateWindowEx nt_user_create_window_ex = 63;</div></div><div><br></div><div>And build.sh seems happy with that.</div><div><br></div><div>I&#39;ve added the following to win7proc.cpp:</div><div><div>Panda__UserCreateWindowEx *cw = (Panda__UserCreateWindowEx *) malloc(sizeof(Panda__UserCreateWindowEx));</div><div>// Do I need to initialise cw some how???</div><div>cw-&gt;proc = create_panda_process(cur_pid, cur_procname);</div><div>cw-&gt;id = 6969;</div><div>Panda__LogEntry ple = PANDA__LOG_ENTRY__INIT;<br></div><div>ple.has_nt_user_create_window_ex = 1; // Line 1652</div><div>ple.nt_user_create_window_ex = cw;</div><div>pandalog_write_entry(&amp;ple);</div></div><div><br></div><div>But when I try and build, I get:</div><div>win7proc.cpp:1652:9: error: ‘Panda__LogEntry’ has no member named ‘has_nt_user_create_window_ex’<br></div><div><br></div><div>I thought given nt_user_create_window_ex is optional, the has_ member would, well, magically exist??</div><div><br></div><div>I have tried Google-ing but &quot;has no has&quot; is quite tricky to Google for :(</div><div><br></div><div>Thanks again!</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 24 April 2016 at 16:39, Brendan Dolan-Gavitt <span dir="ltr">
&lt;<a href="mailto:brendandg@nyu.edu" target="_blank">brendandg@nyu.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Sure! I think what you want is to add a new log entry type. The logs<br>
use protocol buffers to define the structure of each entry type in a<br>
.proto file. So you could edit win7proc.proto and add your new message<br>
type. Then you&#39;d re-run build.sh (which generates C data structures<br>
for the protocol buffers definitions) and you could use your new log<br>
entry type.<br><br>
There are some details on how this stuff works in the manual (though I<br>
just noticed the table of contents doesn&#39;t list the top-level section<br>
for some reason):<br><br><a href="https://github.com/moyix/panda/blob/master/docs/manual.md#pandalog" rel="noreferrer" target="_blank">https://github.com/moyix/panda/blob/master/docs/manual.md#pandalog</a><br><br>
-Brendan<br><div><div><br>
On Sun, Apr 24, 2016 at 11:18 AM, Bridgey theGeek<br>
&lt;<a href="mailto:bridgeythegeek@gmail.com" target="_blank">bridgeythegeek@gmail.com</a>&gt; wrote:<br>
&gt; Hi PANDAs,<br>
&gt;<br>
&gt; I&#39;ve added the functionality to Syscalls2 so that it now understands<br>
&gt; NtUserCreateWindowEx.<br>
&gt; I&#39;m now trying to add to win7proc so that it&#39;s also reported in the log file<br>
&gt; this plugin produces.<br>
&gt;<br>
&gt; In win7proc.cpp I&#39;ve added:<br>
&gt; void w7p_NtUserCreateWindowEx_enter(CPUState* env,<br>
&gt;                     target_ulong pc,<br>
&gt;                     uint32_t dwExStyle,<br>
&gt;                     uint32_t lpClassName,<br>
&gt;                     uint32_t lpWindowName,<br>
&gt;                     uint32_t dwStyle,<br>
&gt;                     int32_t x,<br>
&gt;                     int32_t y,<br>
&gt;                     int32_t nWidth,<br>
&gt;                     int32_t nHeight,<br>
&gt;                     uint32_t hWndParent,<br>
&gt;                     uint32_t hInstance,<br>
&gt;                     target_ulong lpParam) {<br>
&gt;     Panda__LogEntry ple = PANDA__LOG_ENTRY__INIT;<br>
&gt;     ple.has_nt_any_syscall = 1;<br>
&gt;     ple.nt_any_syscall = 6969;<br>
&gt;     pandalog_write_entry(&amp;ple);<br>
&gt;<br>
&gt; And this works. If I replay with the win7proc plugin, when a window is<br>
&gt; created I see:<br>
&gt; instr=419644049 pc=0x778370b2 : nt_any_syscall (num=6969)<br>
&gt;<br>
&gt; Of course what I&#39;d like to be able to report is some helpful metadata like<br>
&gt; the process name, the fact that it&#39;s NtUserCreateWindowEx and ideally the<br>
&gt; value of lpClassName and lpWindowName.<br>
&gt;<br>
&gt; But I just can&#39;t quite follow the logic to see how Panda__LogEntry works.<br>
&gt;<br>
&gt; Can somebody give me a quick explanation..?<br>
&gt;<br>
&gt; Thank you!<br>
&gt; Bridgey<br>
&gt;<br></div></div>
&gt; _______________________________________________<br>
&gt; panda-users mailing list<br>
&gt; <a href="mailto:panda-users@mit.edu" target="_blank">panda-users@mit.edu</a><br>
&gt; <a href="http://mailman.mit.edu/mailman/listinfo/panda-users" rel="noreferrer" target="_blank">
http://mailman.mit.edu/mailman/listinfo/panda-users</a><br>
&gt;<br><span><font color="#888888"><br><br><span class="HOEnZb"><font color="#888888"><br>
--<br>
Brendan Dolan-Gavitt<br>
Assistant Professor, Department of Computer Science and Engineering<br>
NYU Tandon School of Engineering<br></font></span></font></span></blockquote></div><br></div></div></div></span></div>
</blockquote></div><br></div>