Exemple #1
0
        public static JEParser getInstance(Type c)
        {
            JEParser parser = new JEParser ();
            parser.setType (c);

            return parser;
        }
Exemple #2
0
        public static JEParser getInstance(Type c)
        {
            JEParser parser = new JEParser();

            parser.setType(c);

            return(parser);
        }
Exemple #3
0
        void procData(String str)
        {
            try
            {
                JEParser    parser = JEParser.getInstance(typeof(SocketModel));
                SocketModel obj    = (SocketModel)parser.parse(str);

                switch (obj.type)
                {
                case 1:
                    //String log = base64Decode(obj.raw);//.Split(new[] { "\n" }, StringSplitOptions.None);
                    String log = obj.raw;
                    //foreach (String log in logs)
                    //{
                    LogModel model = LogModel.parse(log);
                    parent.logList.Add(model);
                    String[] datas =
                    {
                        "log",
                        model.logBody.ipHeader.protocol.ToString(),
                        model.logBody.senderIp,
                        model.logBody.receiverIp,
                        model.logHeader.alertSig.alertMsg
                    };

                    /*
                     * ListViewItem item = null;
                     * foreach (String data in datas)
                     * {
                     *  if (item == null)
                     *  {
                     *      item = new ListViewItem(data);
                     *  }
                     *  else
                     *  {
                     *      item.SubItems.Add(data);
                     *  }
                     *
                     * }
                     * listView1.Invoke(new DelegateFunction(addItem), new object[] { item });
                     * //                        listView1.Items.Add(item);
                     */
                    //}
                    break;

                case 2:
                    break;

                case 3:
                    break;

                case 4:
                    break;

                case 5:
                    break;

                case 6:

                    fw_Log flog = new fw_Log(obj.raw);
                    MainForm.fLogList.Add(flog);

                    ListViewItem fw_item = null;
                    fw_item = new ListViewItem(flog.Dest_ip);
                    fw_item.SubItems.Add(flog.Dest_port);
                    fw_item.SubItems.Add(flog.raw);

                    parent.listView1.Invoke(new MainForm.DelegateFunction(fw_addItem), new object[] { fw_item });

                    fw_Log fwlog = new fw_Log(obj.raw);
                    //MessageBox.Show("sip:" + fwlog.Src_ip + " dip:" + fwlog.Dest_ip);
                    //MessageBox.Show(fwlog.raw);
                    fw_item = null;
                    fw_item = new ListViewItem(fwlog.Src_ip);
                    fw_item.SubItems.Add(fwlog.Src_port);
                    fw_item.SubItems.Add(fwlog.Dest_ip);
                    fw_item.SubItems.Add(fwlog.Dest_port);
                    fw_item.SubItems.Add(fwlog.raw);

                    parent.fw_log_listview.Invoke(new MainForm.DelegateFunction(fw_addItem), new object[] { fw_item });
                    //fw_log_listview.Items.Add(fw_item);
                    break;
                }
            }
            catch (Exception e)
            {
                //                sendMessage("{\"type\":3, \"msg\":\"error\"");
                WriteLine("parse error" + e.Message);
            }
        }