Repository: wanduow/libprotoident Branch: master Commit: 97a8efecd257 Files: 602 Total size: 1.7 MB Directory structure: gitextract_usa0_lis/ ├── .github/ │ └── workflows/ │ ├── pkg-build.yaml │ └── rpm-build.yaml ├── .gitignore ├── .gitmodules ├── COPYING ├── COPYING.LESSER ├── ChangeLog ├── Makefile.am ├── README ├── bootstrap.sh ├── configure.ac ├── debian/ │ ├── changelog │ ├── compat │ ├── control │ ├── copyright │ ├── libprotoident-dev.dirs │ ├── libprotoident-dev.install │ ├── libprotoident-tools.dirs │ ├── libprotoident-tools.install │ ├── libprotoident.dirs │ ├── libprotoident.install │ ├── rules │ └── source/ │ └── format ├── debpkg-build.sh ├── debpkg-setup.sh ├── lib/ │ ├── Makefile.am │ ├── libprotoident.cc │ ├── libprotoident.h │ ├── proto_common.cc │ ├── proto_common.h │ ├── proto_manager.cc │ ├── proto_manager.h │ ├── tcp/ │ │ ├── Makefile.am │ │ ├── lpi_300heroes.cc │ │ ├── lpi_360safeguard.cc │ │ ├── lpi_4d.cc │ │ ├── lpi_acestream.cc │ │ ├── lpi_afp.cc │ │ ├── lpi_airdroid.cc │ │ ├── lpi_airmedia.cc │ │ ├── lpi_akamai.cc │ │ ├── lpi_amp.cc │ │ ├── lpi_antcoin.cc │ │ ├── lpi_appearin.cc │ │ ├── lpi_apple_push.cc │ │ ├── lpi_ares.cc │ │ ├── lpi_badbaidu.cc │ │ ├── lpi_baofeng_tcp.cc │ │ ├── lpi_beam.cc │ │ ├── lpi_bitcoin.cc │ │ ├── lpi_bitextend.cc │ │ ├── lpi_bittorrent.cc │ │ ├── lpi_blackdesert.cc │ │ ├── lpi_blizzard.cc │ │ ├── lpi_btsync.cc │ │ ├── lpi_bwsyncandshare.cc │ │ ├── lpi_cacaoweb.cc │ │ ├── lpi_cgp.cc │ │ ├── lpi_chatango.cc │ │ ├── lpi_cisco_vpn.cc │ │ ├── lpi_clashofclans.cc │ │ ├── lpi_classin_tcp.cc │ │ ├── lpi_clubbox.cc │ │ ├── lpi_cod_waw.cc │ │ ├── lpi_conquer.cc │ │ ├── lpi_crashplan.cc │ │ ├── lpi_crossfire_tcp.cc │ │ ├── lpi_cryptic.cc │ │ ├── lpi_cvs.cc │ │ ├── lpi_dahua_tcp.cc │ │ ├── lpi_dash.cc │ │ ├── lpi_dell_backup.cc │ │ ├── lpi_destiny.cc │ │ ├── lpi_diablo3.cc │ │ ├── lpi_dianping_tcp.cc │ │ ├── lpi_directconnect.cc │ │ ├── lpi_dnf.cc │ │ ├── lpi_dns.cc │ │ ├── lpi_dogecoin.cc │ │ ├── lpi_douyu.cc │ │ ├── lpi_douyu_chat.cc │ │ ├── lpi_duelingnetwork.cc │ │ ├── lpi_dvrns.cc │ │ ├── lpi_dxp.cc │ │ ├── lpi_ea_games.cc │ │ ├── lpi_emule.cc │ │ ├── lpi_ethernetip.cc │ │ ├── lpi_eye.cc │ │ ├── lpi_facebook_turn.cc │ │ ├── lpi_fb_message.cc │ │ ├── lpi_fbcdn_ssl.cc │ │ ├── lpi_ffxiv.cc │ │ ├── lpi_filenori.cc │ │ ├── lpi_flash.cc │ │ ├── lpi_fliggy.cc │ │ ├── lpi_fring.cc │ │ ├── lpi_ftpcontrol.cc │ │ ├── lpi_ftpdata.cc │ │ ├── lpi_fuckcoin.cc │ │ ├── lpi_funshion.cc │ │ ├── lpi_gamespy.cc │ │ ├── lpi_gcafe_updater.cc │ │ ├── lpi_giop.cc │ │ ├── lpi_git.cc │ │ ├── lpi_glupteba.cc │ │ ├── lpi_gnutella.cc │ │ ├── lpi_goku.cc │ │ ├── lpi_googlehangouts.cc │ │ ├── lpi_graalonlineera.cc │ │ ├── lpi_guildwars2.cc │ │ ├── lpi_hamachi.cc │ │ ├── lpi_harveys.cc │ │ ├── lpi_hearthstone.cc │ │ ├── lpi_hola.cc │ │ ├── lpi_hots_tcp.cc │ │ ├── lpi_http.cc │ │ ├── lpi_http_badport.cc │ │ ├── lpi_http_nonstandard.cc │ │ ├── lpi_http_tunnel.cc │ │ ├── lpi_https.cc │ │ ├── lpi_ica.cc │ │ ├── lpi_icep.cc │ │ ├── lpi_id.cc │ │ ├── lpi_idrivesync.cc │ │ ├── lpi_ihexin.cc │ │ ├── lpi_imap.cc │ │ ├── lpi_imaps.cc │ │ ├── lpi_imesh.cc │ │ ├── lpi_invalid.cc │ │ ├── lpi_invalid_bittorrent.cc │ │ ├── lpi_invalid_http.cc │ │ ├── lpi_invalid_pop.cc │ │ ├── lpi_invalid_smtp.cc │ │ ├── lpi_ipfs.cc │ │ ├── lpi_ipop.cc │ │ ├── lpi_ipsharkk.cc │ │ ├── lpi_irc.cc │ │ ├── lpi_java.cc │ │ ├── lpi_jedi.cc │ │ ├── lpi_jx3online.cc │ │ ├── lpi_kakao.cc │ │ ├── lpi_kankan_tcp.cc │ │ ├── lpi_kaseya.cc │ │ ├── lpi_kaspersky.cc │ │ ├── lpi_kik.cc │ │ ├── lpi_kingofglory_tcp.cc │ │ ├── lpi_kuaibo.cc │ │ ├── lpi_ldap.cc │ │ ├── lpi_lifeforge.cc │ │ ├── lpi_line.cc │ │ ├── lpi_litecoin.cc │ │ ├── lpi_llp2p.cc │ │ ├── lpi_maplestory_china.cc │ │ ├── lpi_maxicloud.cc │ │ ├── lpi_message4u.cc │ │ ├── lpi_minecraft.cc │ │ ├── lpi_mitglieder.cc │ │ ├── lpi_mms.cc │ │ ├── lpi_mongo.cc │ │ ├── lpi_mp2p.cc │ │ ├── lpi_msn.cc │ │ ├── lpi_msnc.cc │ │ ├── lpi_msnv.cc │ │ ├── lpi_munin.cc │ │ ├── lpi_mysql.cc │ │ ├── lpi_mystery_8000.cc │ │ ├── lpi_mystery_9000.cc │ │ ├── lpi_mystery_conn.cc │ │ ├── lpi_mystery_iG.cc │ │ ├── lpi_mystery_pspr.cc │ │ ├── lpi_mystery_rxxf.cc │ │ ├── lpi_mystery_symantec.cc │ │ ├── lpi_mzinga.cc │ │ ├── lpi_naverp2p.cc │ │ ├── lpi_ncsoft.cc │ │ ├── lpi_ndt_tput.cc │ │ ├── lpi_netbios.cc │ │ ├── lpi_netcat_cctv.cc │ │ ├── lpi_netmfp.cc │ │ ├── lpi_nntp.cc │ │ ├── lpi_nntps.cc │ │ ├── lpi_nofirstpkt.cc │ │ ├── lpi_nomachine.cc │ │ ├── lpi_nopayload.cc │ │ ├── lpi_norton_backup.cc │ │ ├── lpi_notes_rpc.cc │ │ ├── lpi_nsq.cc │ │ ├── lpi_omegle.cc │ │ ├── lpi_openvpn.cc │ │ ├── lpi_ourworld.cc │ │ ├── lpi_palringo.cc │ │ ├── lpi_paltalk.cc │ │ ├── lpi_pandatv.cc │ │ ├── lpi_pando.cc │ │ ├── lpi_pathofexile.cc │ │ ├── lpi_pdbox.cc │ │ ├── lpi_pop3.cc │ │ ├── lpi_pop3s.cc │ │ ├── lpi_postgresql.cc │ │ ├── lpi_pptp.cc │ │ ├── lpi_psn_store.cc │ │ ├── lpi_qcloud_ilvb.cc │ │ ├── lpi_qq_tcp.cc │ │ ├── lpi_qqdownload.cc │ │ ├── lpi_qqlive_tcp.cc │ │ ├── lpi_qqspeedmobile_tcp.cc │ │ ├── lpi_qvod.cc │ │ ├── lpi_rabbitmq.cc │ │ ├── lpi_ragnarokonline.cc │ │ ├── lpi_razor.cc │ │ ├── lpi_rbls.cc │ │ ├── lpi_rdp.cc │ │ ├── lpi_realmofthemadgod.cc │ │ ├── lpi_realvnc.cc │ │ ├── lpi_rejection.cc │ │ ├── lpi_relay.cc │ │ ├── lpi_remote_manipulator.cc │ │ ├── lpi_revolver_nblbt.cc │ │ ├── lpi_rfb.cc │ │ ├── lpi_rpcscan.cc │ │ ├── lpi_rrtv.cc │ │ ├── lpi_rsync.cc │ │ ├── lpi_rtmp.cc │ │ ├── lpi_rtsp.cc │ │ ├── lpi_runescape.cc │ │ ├── lpi_s7comm.cc │ │ ├── lpi_saprouter.cc │ │ ├── lpi_saszombieassault4.cc │ │ ├── lpi_second_life.cc │ │ ├── lpi_shoutcast.cc │ │ ├── lpi_silkroadonline.cc │ │ ├── lpi_sip.cc │ │ ├── lpi_skyforge.cc │ │ ├── lpi_skype_tcp.cc │ │ ├── lpi_smb.cc │ │ ├── lpi_smite_tcp.cc │ │ ├── lpi_smtp.cc │ │ ├── lpi_smtps.cc │ │ ├── lpi_socks4.cc │ │ ├── lpi_socks5.cc │ │ ├── lpi_spdy.cc │ │ ├── lpi_speedify.cc │ │ ├── lpi_speedin.cc │ │ ├── lpi_speedtest.cc │ │ ├── lpi_spotify.cc │ │ ├── lpi_ssh.cc │ │ ├── lpi_ssjj.cc │ │ ├── lpi_ssl.cc │ │ ├── lpi_steam.cc │ │ ├── lpi_stratum.cc │ │ ├── lpi_stun.cc │ │ ├── lpi_supl.cc │ │ ├── lpi_svn.cc │ │ ├── lpi_talesrunner.cc │ │ ├── lpi_tankionline.cc │ │ ├── lpi_tankix.cc │ │ ├── lpi_taobao.cc │ │ ├── lpi_tds.cc │ │ ├── lpi_teamviewer.cc │ │ ├── lpi_telecomkey.cc │ │ ├── lpi_telegram.cc │ │ ├── lpi_telnet.cc │ │ ├── lpi_telnet_exploit.cc │ │ ├── lpi_tencent_games.cc │ │ ├── lpi_tenfivecoin.cc │ │ ├── lpi_tensafe.cc │ │ ├── lpi_tera.cc │ │ ├── lpi_tetrisonline.cc │ │ ├── lpi_thedivision.cc │ │ ├── lpi_tip.cc │ │ ├── lpi_tor.cc │ │ ├── lpi_tpkt.cc │ │ ├── lpi_trackmania.cc │ │ ├── lpi_transocks.cc │ │ ├── lpi_trion.cc │ │ ├── lpi_trojan_win32_generic_sb.cc │ │ ├── lpi_trojan_zeroaccess.cc │ │ ├── lpi_twitcasting.cc │ │ ├── lpi_twitch_irc.cc │ │ ├── lpi_utherverse.cc │ │ ├── lpi_vainglory.cc │ │ ├── lpi_vhdp2p.cc │ │ ├── lpi_viber.cc │ │ ├── lpi_vmware.cc │ │ ├── lpi_vodlocker.cc │ │ ├── lpi_vpnrobot_tcp.cc │ │ ├── lpi_vpnunlimited_tcp.cc │ │ ├── lpi_warcraft3.cc │ │ ├── lpi_web_junk.cc │ │ ├── lpi_webex_stun.cc │ │ ├── lpi_weblogic.cc │ │ ├── lpi_wechat.cc │ │ ├── lpi_weibo.cc │ │ ├── lpi_weiqi.cc │ │ ├── lpi_whatsapp.cc │ │ ├── lpi_whois.cc │ │ ├── lpi_winmx.cc │ │ ├── lpi_wizard101.cc │ │ ├── lpi_wns.cc │ │ ├── lpi_wow.cc │ │ ├── lpi_wuala.cc │ │ ├── lpi_xiami.cc │ │ ├── lpi_xmpp.cc │ │ ├── lpi_xmpps.cc │ │ ├── lpi_xunlei.cc │ │ ├── lpi_xunlei_accel.cc │ │ ├── lpi_xymon.cc │ │ ├── lpi_yahoo.cc │ │ ├── lpi_yahoo_error.cc │ │ ├── lpi_yahoo_games.cc │ │ ├── lpi_yahoo_webcam.cc │ │ ├── lpi_youku.cc │ │ ├── lpi_yy_tcp.cc │ │ ├── lpi_zabbix.cc │ │ ├── lpi_zero.cc │ │ ├── lpi_zoom_tcp.cc │ │ ├── lpi_zynga.cc │ │ └── tcp_protocols.h │ └── udp/ │ ├── Makefile.am │ ├── lpi_360cn.cc │ ├── lpi_360p2p.cc │ ├── lpi_aachen_udp.cc │ ├── lpi_acercloud.cc │ ├── lpi_akamai.cc │ ├── lpi_akamai_transfer.cc │ ├── lpi_amanda.cc │ ├── lpi_apple_facetime_init.cc │ ├── lpi_ard.cc │ ├── lpi_ares.cc │ ├── lpi_ark.cc │ ├── lpi_arma3_server.cc │ ├── lpi_arma_server.cc │ ├── lpi_artcp.cc │ ├── lpi_assettocorsa.cc │ ├── lpi_avast_secure_dns.cc │ ├── lpi_backweb.cc │ ├── lpi_bacnet.cc │ ├── lpi_baiduyun_p2p.cc │ ├── lpi_baofeng_udp.cc │ ├── lpi_battlefield.cc │ ├── lpi_bjnp.cc │ ├── lpi_bmdp.cc │ ├── lpi_btsync.cc │ ├── lpi_cacaoweb_udp.cc │ ├── lpi_canon_mfnp.cc │ ├── lpi_chargen_exploit.cc │ ├── lpi_checkpoint_rdp.cc │ ├── lpi_chivalry.cc │ ├── lpi_cip_io.cc │ ├── lpi_cirn.cc │ ├── lpi_cisco_ipsec.cc │ ├── lpi_cisco_sslvpn.cc │ ├── lpi_classin_udp.cc │ ├── lpi_cloudflare_warp.cc │ ├── lpi_cod.cc │ ├── lpi_codmobile.cc │ ├── lpi_combatarms.cc │ ├── lpi_combatarms_p2p.cc │ ├── lpi_contract_wars.cc │ ├── lpi_crossfire.cc │ ├── lpi_crossout.cc │ ├── lpi_csgo.cc │ ├── lpi_csoriginal.cc │ ├── lpi_dahua.cc │ ├── lpi_db2.cc │ ├── lpi_dcc.cc │ ├── lpi_demonware.cc │ ├── lpi_destiny_udp.cc │ ├── lpi_dhcp.cc │ ├── lpi_dht_dict.cc │ ├── lpi_dht_other.cc │ ├── lpi_diablo2.cc │ ├── lpi_dianping_udp.cc │ ├── lpi_dianshijia.cc │ ├── lpi_directconnect.cc │ ├── lpi_discord.cc │ ├── lpi_dns.cc │ ├── lpi_dota2.cc │ ├── lpi_doyo.cc │ ├── lpi_driveshare.cc │ ├── lpi_dtls.cc │ ├── lpi_emule.cc │ ├── lpi_emule_weak.cc │ ├── lpi_epson.cc │ ├── lpi_eso.cc │ ├── lpi_esp_encap.cc │ ├── lpi_ethernetip.cc │ ├── lpi_eye.cc │ ├── lpi_fasp.cc │ ├── lpi_feitwo.cc │ ├── lpi_forticlient_sslvpn.cc │ ├── lpi_fortinet.cc │ ├── lpi_foscam.cc │ ├── lpi_freechal.cc │ ├── lpi_freefire.cc │ ├── lpi_funshion.cc │ ├── lpi_gamespy.cc │ ├── lpi_ganglia.cc │ ├── lpi_gangsofspace.cc │ ├── lpi_garena.cc │ ├── lpi_gearsofwar.cc │ ├── lpi_gnutella.cc │ ├── lpi_gnutella2.cc │ ├── lpi_gnutella_weak.cc │ ├── lpi_gotomeeting.cc │ ├── lpi_gprs_tunnel.cc │ ├── lpi_gsm.cc │ ├── lpi_h1z1.cc │ ├── lpi_halflife.cc │ ├── lpi_haloonline.cc │ ├── lpi_hamachi.cc │ ├── lpi_heliborne.cc │ ├── lpi_heroes_generals.cc │ ├── lpi_heroesevolved.cc │ ├── lpi_hollachat.cc │ ├── lpi_hots.cc │ ├── lpi_icp.cc │ ├── lpi_imesh.cc │ ├── lpi_ipmsg.cc │ ├── lpi_ipv6.cc │ ├── lpi_isakmp.cc │ ├── lpi_jedi.cc │ ├── lpi_jedi_academy.cc │ ├── lpi_kademlia.cc │ ├── lpi_kankan.cc │ ├── lpi_kaspersky.cc │ ├── lpi_kazaa.cc │ ├── lpi_kingofglory_udp.cc │ ├── lpi_kuguo.cc │ ├── lpi_l2tp.cc │ ├── lpi_lansync.cc │ ├── lpi_ldap_ad.cc │ ├── lpi_line_udp.cc │ ├── lpi_linkproof.cc │ ├── lpi_loadout.cc │ ├── lpi_lol.cc │ ├── lpi_mdns.cc │ ├── lpi_merakicloud.cc │ ├── lpi_moh.cc │ ├── lpi_moonhunters.cc │ ├── lpi_mp2p.cc │ ├── lpi_msn_cache.cc │ ├── lpi_msn_video.cc │ ├── lpi_msoffice_mac.cc │ ├── lpi_mta.cc │ ├── lpi_mystery_02_36.cc │ ├── lpi_mystery_05.cc │ ├── lpi_mystery_0660.cc │ ├── lpi_mystery_0d.cc │ ├── lpi_mystery_45.cc │ ├── lpi_mystery_61_72.cc │ ├── lpi_mystery_8000.cc │ ├── lpi_mystery_99.cc │ ├── lpi_mystery_bt_udp.cc │ ├── lpi_mystery_e9.cc │ ├── lpi_mystery_emule.cc │ ├── lpi_mystery_qq.cc │ ├── lpi_n2ping.cc │ ├── lpi_natpmp.cc │ ├── lpi_netbios.cc │ ├── lpi_netcat_cctv_udp.cc │ ├── lpi_netcore_scan.cc │ ├── lpi_netflow.cc │ ├── lpi_newerth.cc │ ├── lpi_nintendo.cc │ ├── lpi_noction.cc │ ├── lpi_noe.cc │ ├── lpi_nopayload.cc │ ├── lpi_norton.cc │ ├── lpi_ntp.cc │ ├── lpi_ntp_reflect.cc │ ├── lpi_nvidia_gamestream.cc │ ├── lpi_nwn.cc │ ├── lpi_opaserv.cc │ ├── lpi_openvpn.cc │ ├── lpi_orbit.cc │ ├── lpi_overwatch.cc │ ├── lpi_paladins.cc │ ├── lpi_pando.cc │ ├── lpi_panipani.cc │ ├── lpi_planetside2.cc │ ├── lpi_portmap_rpc.cc │ ├── lpi_pplive.cc │ ├── lpi_ppstream.cc │ ├── lpi_probable_gnutella.cc │ ├── lpi_ps4_remoteplay.cc │ ├── lpi_psn.cc │ ├── lpi_punkbuster.cc │ ├── lpi_pyzor.cc │ ├── lpi_qq.cc │ ├── lpi_qqlive.cc │ ├── lpi_qqpcmgr.cc │ ├── lpi_qqspeedmobile_udp.cc │ ├── lpi_quake.cc │ ├── lpi_quic.cc │ ├── lpi_qvod_udp.cc │ ├── lpi_radius.cc │ ├── lpi_raknet.cc │ ├── lpi_ramseydash.cc │ ├── lpi_rdp_udp.cc │ ├── lpi_real.cc │ ├── lpi_risingstorm.cc │ ├── lpi_robocraft.cc │ ├── lpi_rocket_league.cc │ ├── lpi_rrshare.cc │ ├── lpi_rtcp.cc │ ├── lpi_rtmfp.cc │ ├── lpi_rtp.cc │ ├── lpi_rulesofsurvival.cc │ ├── lpi_sanandreas_mp.cc │ ├── lpi_second_life.cc │ ├── lpi_serialnumberd.cc │ ├── lpi_sip.cc │ ├── lpi_skype.cc │ ├── lpi_slp.cc │ ├── lpi_smite.cc │ ├── lpi_snapvpn.cc │ ├── lpi_snmp.cc │ ├── lpi_sopcast.cc │ ├── lpi_spamfighter.cc │ ├── lpi_spotify_bcast.cc │ ├── lpi_sql_worm.cc │ ├── lpi_ssdp.cc │ ├── lpi_starcitizen.cc │ ├── lpi_starcraft.cc │ ├── lpi_starleaf.cc │ ├── lpi_steam.cc │ ├── lpi_steam_inhomebroadcast.cc │ ├── lpi_steam_localbroadcast.cc │ ├── lpi_steamfriends.cc │ ├── lpi_storm_worm.cc │ ├── lpi_stun.cc │ ├── lpi_syslog.cc │ ├── lpi_talesrunner_udp.cc │ ├── lpi_teamspeak.cc │ ├── lpi_teamviewer.cc │ ├── lpi_teredo.cc │ ├── lpi_tf2.cc │ ├── lpi_tftp.cc │ ├── lpi_thecrew.cc │ ├── lpi_thq.cc │ ├── lpi_torchlight2.cc │ ├── lpi_tox.cc │ ├── lpi_traceroute.cc │ ├── lpi_tremulous.cc │ ├── lpi_turbovpn.cc │ ├── lpi_tvants.cc │ ├── lpi_ubisoft_games.cc │ ├── lpi_umeye.cc │ ├── lpi_unreal.cc │ ├── lpi_ventrilo.cc │ ├── lpi_viber.cc │ ├── lpi_vivox.cc │ ├── lpi_vpnmaster.cc │ ├── lpi_vpnrobot_udp.cc │ ├── lpi_vxworks_exploit.cc │ ├── lpi_warthunder.cc │ ├── lpi_webex.cc │ ├── lpi_wechat_udp.cc │ ├── lpi_winmessage.cc │ ├── lpi_wireguard.cc │ ├── lpi_wolfet.cc │ ├── lpi_worm_22105.cc │ ├── lpi_xfire_p2p.cc │ ├── lpi_xlsp.cc │ ├── lpi_xunlei.cc │ ├── lpi_xunlei_jsq.cc │ ├── lpi_xunyou.cc │ ├── lpi_youdao_dict.cc │ ├── lpi_youku.cc │ ├── lpi_yuanfudao.cc │ ├── lpi_yy_udp.cc │ ├── lpi_zalo_call.cc │ ├── lpi_zeroaccess_udp.cc │ ├── lpi_zoom.cc │ └── udp_protocols.h ├── rpm/ │ └── libprotoident.spec ├── rpmpkg-build.sh ├── rpmpkg-setup.sh ├── test/ │ └── lpi_test_results └── tools/ ├── Makefile.am ├── Makefile.tools ├── arff/ │ ├── Makefile.am │ ├── lpi_arff.1 │ └── lpi_arff.cc ├── find_unknown/ │ ├── Makefile.am │ ├── lpi_find_unknown.1 │ └── lpi_find_unknown.cc ├── live/ │ ├── Makefile.am │ ├── collector.cc │ ├── live_common.cc │ ├── live_common.h │ ├── lpi_live.cc │ ├── lpicp.cc │ ├── lpicp.h │ ├── lpicp_export.cc │ └── lpicp_export.h ├── protoident/ │ ├── Makefile.am │ ├── lpi_protoident.1 │ └── lpi_protoident.cc ├── tools_common.cc └── tools_common.h ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/workflows/pkg-build.yaml ================================================ name: Packaging for Debian and Ubuntu on: push: tags: - '*' jobs: build: runs-on: ubuntu-latest container: image: ${{ matrix.target }} strategy: fail-fast: false matrix: arch: - amd64 target: - "debian:stretch" - "debian:buster" - "debian:bullseye" - "ubuntu:xenial" - "ubuntu:bionic" - "ubuntu:focal" steps: - name: Checkout repo uses: actions/checkout@v2 - name: Install prereq packages run: ./debpkg-setup.sh - name: Build packages run: ./debpkg-build.sh - name: Store packages run: | export DIRNAME=`echo ${{ matrix.target }} | tr ':' '_'` mkdir -p packages/${DIRNAME} cp ../*.deb packages/${DIRNAME}/ - name: Publish packages to cloudsmith uses: wanduow/action-cloudsmith-upload-packages@v1 with: path: packages/ repo: ${{ secrets.CLOUDSMITH_OWNER }}/libprotoident username: salcock api_key: ${{ secrets.CLOUDSMITH_API_KEY }} ================================================ FILE: .github/workflows/rpm-build.yaml ================================================ name: Packaging for Centos and Fedora on: push: tags: - '*' jobs: build: runs-on: ubuntu-latest container: image: ${{ matrix.target }} strategy: fail-fast: false matrix: arch: - amd64 target: - "centos:7" - "centos:8" - "fedora:33" - "fedora:32" steps: - name: Checkout repo uses: actions/checkout@v2 - name: Install prereq packages run: ./rpmpkg-setup.sh ${{ matrix.target }} - name: Build packages run: ./rpmpkg-build.sh ${{ matrix.target }} - name: Store packages run: | export DIRNAME=`echo ${{ matrix.target }} | tr ':' '_'` mkdir -p packages/${DIRNAME} cp ~/rpmbuild/RPMS/x86_64/*.rpm packages/${DIRNAME}/ - name: Publish packages to cloudsmith uses: wanduow/action-cloudsmith-upload-packages@v1 with: path: packages/ repo: ${{ secrets.CLOUDSMITH_OWNER }}/libprotoident username: salcock api_key: ${{ secrets.CLOUDSMITH_API_KEY }} ================================================ FILE: .gitignore ================================================ *.la *.o *.lo *Makefile.in *Makefile *.deps *.libs *.swp config\.* configure autom4te.cache/ depcomp install-sh aclocal.m4 libtool ltmain.sh missing stamp-h1 tools/arff/lpi_arff tools/find_unknown/lpi_find_unknown tools/protoident/lpi_protoident ================================================ FILE: .gitmodules ================================================ [submodule "libflowmanager"] path = libflowmanager url = https://github.com/wanduow/libflowmanager [submodule "libtrace"] path = libtrace url = https://github.com/LibtraceTeam/libtrace ================================================ FILE: COPYING ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: COPYING.LESSER ================================================ GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. ================================================ FILE: ChangeLog ================================================ Full ChangeLog details can now be found at: https://github.com/wanduow/libprotoident/wiki/ChangeLog ================================================ FILE: Makefile.am ================================================ SUBDIRS=lib if BUILD_LPI_TOOLS SUBDIRS+=tools endif AUTOMAKE_OPTIONS = foreign ================================================ FILE: README ================================================ libprotoident 2.0.15 --------------------------------------------------------------------------- Copyright (c) 2011-2020 The University of Waikato, Hamilton, New Zealand. All rights reserved. This code has been developed by the University of Waikato WAND research group. For further information please see http://www.wand.net.nz/. --------------------------------------------------------------------------- See the file COPYING and COPYING.LESSER for full licensing details for this software. Report and bugs, questions or comments to contact@wand.net.nz NEW: You can now lodge bugs by filing an issue on the libprotoident github: https://github.com/wanduow/libprotoident Authors: Shane Alcock With contributions from: Donald Neal Aaron Murrihy Paweł Foremski Fabian Weisshaar Jeroen Roovers Jiri Havranek Romain Fontugne Jacob van Walraven Introduction ============ Libprotoident is a library designed to perform application protocol identification using a very limited form of deep packet inspection, i.e. using the first four bytes of application payload sent in each direction. The library provides a simple API that will enable programmers to develop their own tools that utilise application protocol information and we have also included some tools that can be used to perform simple analysis of traffic flows. Required Libraries ================== libtrace 4.0.1 or later * available from https://github.com/LibtraceTeam/libtrace libflowmanager 3.0.0 or later * optional, but required to build the tools * available from https://github.com/LibtraceTeam/libflowmanager Installation ============ After having installed the required libraries, running the following series of commands should install libprotoident ./bootstrap.sh (only if you've cloned the source from GitHub) ./configure make make install By default, libprotoident installs to /usr/local - this can be changed by appending the --prefix= option to ./configure. The libprotoident tools are built by default - this can be changed by using the --with-tools=no option with ./configure. Protocols Supported =================== A full list of supported protocols can be found at https://github.com/wanduow/libprotoident/wiki/SupportedProtocols Libprotoident also currently has rules for several "mystery" protocols. These are patterns that commonly occur in our trace sets that we cannot tie to an actual protocol. It would be nice to know what these protocols actually are - if you have any suggestions please feel free to email us at contact@wand.net.nz. In addition, a flow can be assigned into a "category" based on the protocol determined by libprotoident, enabling broader analysis. For example, BitTorrent, Gnutella and eMule all fall into the P2P category, whereas SMTP, POP3 and IMAP are part of the Mail category. Tools ===== There are three tools included with libprotoident. * lpi_protoident Description: This tool attempts to identify each individual flow within the provided trace. Identification only occurs when the flow has concluded or expired, so it is not very effective for real-time applications. Usage: lpi_protoident The input trace must be a valid libtrace URI. See https://github.com/LibtraceTeam/libtrace/wiki/Supported-Trace-Formats to learn more about libtrace URIs. Note that a URI may be a live source, such as a network interface. Output: For each flow in the input trace, a single line is printed to stdout describing the flow. The line contains the following fields separated by spaces (in order): * Application protocol (as reported by libprotoident) * IP address of the first endpoint * IP address of the second endpoint * Port used by the first endpoint * Port used by the second endpoint * Transport protocol (6 = TCP, 17 = UDP) * Unix timestamp when the flow began * Unix timestamp when the flow ended * Total bytes sent from first endpoint to second endpoint * Total bytes sent from second endpoint to first endpoint * First four bytes of payload sent from first endpoint (in hex) * First four bytes of payload sent from first endpoint (ASCII) * Size of first payload-bearing packet sent from first endpoint * First four bytes of payload sent from second endpoint (in hex) * First four bytes of payload sent from second endpoint (ASCII) * Size of first payload-bearing packet sent from second endpoint * lpi_find_unknown Description: This tool reports all the flows in a trace which libprotoident was unable to identify. Identification only occurs when the flow has concluded or expired, so it is not very effective for real-time applications. This is mainly intended as a tool to aid development of new protocol identifiers. Usage: lpi_find_unknown The input trace must be a valid libtrace URI. See https://github.com/LibtraceTeam/libtrace/wiki/Supported-Trace-Formats to learn more about libtrace URIs. Note that a URI may be a live source, such as a network interface. Output: For each unknown flow in the input trace, a single line is printed to stdout describing the flow. The line contains the following fields separated by spaces (in order): * IP address of the first endpoint * IP address of the second endpoint * Port used by the first endpoint * Port used by the second endpoint * Transport protocol (6 = TCP, 17 = UDP) * Unix timestamp when the flow began * Total bytes sent from first endpoint to second endpoint * Total bytes sent from second endpoint to first endpoint * First four bytes of payload sent from first endpoint (in hex) * First four bytes of payload sent from first endpoint (ASCII) * Size of first payload-bearing packet sent from first endpoint * First four bytes of payload sent from second endpoint (in hex) * First four bytes of payload sent from second endpoint (ASCII) * Size of first payload-bearing packet sent from second endpoint * lpi_arff Description: This tool is similar to lpi_protoident except that it writes its output in the ARFF format so that it is compatible with the Weka machine learning software (http://www.cs.waikato.ac.nz/ml/weka/). This tool was contributed by Paweł Foremski . Usage: lpi_arff The input trace must be a valid libtrace URI. See https://github.com/LibtraceTeam/libtrace/wiki/Supported-Trace-Formats to learn more about libtrace URIs. Note that a URI may be a live source, such as a network interface. Output: The output begins with a series of lines describing each feature that will be used to describe each flow. Following that, for each flow in the input trace, a single line is printed to stdout describing the flow. The line contains the following fields separated by commas (in order): * Application protocol (as reported by libprotoident) * ID number for the application protocol * Total number of packets sent from first endpoint to second endpoint * Total number of bytes sent from first endpoint to second endpoint * Total number of packets sent from second endpoint to first endpoint * Total number of bytes sent from second endpoint to first endpoint * Minimum payload size sent from first endpoint to second endpoint * Mean payload size sent from first endpoint to second endpoint * Maximum payload size sent from first endpoint to second endpoint * Standard deviation of payload size sent from first endpoint to second endpoint * Minimum payload size sent from second endpoint to first endpoint * Mean payload size sent from second endpoint to first endpoint * Maximum payload size sent from second endpoint to first endpoint * Standard deviation of payload size sent from second endpoint to first endpoint * Minimum packet interarrival time for packets sent from first endpoint to second endpoint * Mean packet interarrival time for packets sent from first endpoint to second endpoint * Maximum packet interarrival time for packets sent from first endpoint to second endpoint * Standard deviation of packet interarrival time for packets sent from first endpoint to second endpoint * Minimum packet interarrival time for packets sent from second endpoint to first endpoint * Mean packet interarrival time for packets sent from second endpoint to first endpoint * Maximum packet interarrival time for packets sent from second endpoint to first endpoint * Standard deviation of packet interarrival time for packets sent from second endpoint to first endpoint * Flow duration (in microseconds) * Flow start time (as a Unix timestamp) API === If you want to develop your own tools based on libprotoident, you'll need to use the libprotoident API. The API is very simple and the best way to learn it is to examine how the existing tools work. The source for the tools is located in the tools/ directory. The tools use libflowmanager to do the flow tracking, using an instance of a FlowManager class. You will probably want to incorporate this into your own tool. Usage of libprotoident itself is through functions beginning with 'lpi_'. The libprotoident API functions themselves are documented in lib/libprotoident.h if you need further guidance. Further documentation of the API can also be found at https://github.com/LibtraceTeam/libflowmanager If all else fails, drop me a line at shane@alcock.co.nz ================================================ FILE: bootstrap.sh ================================================ #! /bin/sh set -x # Prefer aclocal 1.9 if we can find it aclocal-1.11 || aclocal-1.9 || aclocal # Darwin bizarrely uses glibtoolize libtoolize --force --copy || glibtoolize --force --copy autoheader2.50 || autoheader # Prefer automake-1.9 if we can find it automake-1.11 --add-missing --copy --foreign || automake-1.10 --add-missing --copy --foreign || automake-1.9 --add-missing --copy --foreign || automake --add-missing --copy --foreign autoconf2.50 || autoconf ================================================ FILE: configure.ac ================================================ AC_INIT(libprotoident, 2.0.15, contact@wand.net.nz) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR(lib/libprotoident.cc) AM_CONFIG_HEADER(config.h) # Make sure we use the relatively silent automake output m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) AC_PREFIX_DEFAULT(/usr/local/) # Function that checks if the C++ compiler actually works - there's a bit of # oversight in autoconf that will set the C++ compiler to g++ if no compiler # is found, even if g++ is not present! So we need an extra test to make sure # that the compiler works :( AC_DEFUN([rw_PROG_CXX_WORKS], [AC_REQUIRE([AC_PROG_CXX])dnl AC_CACHE_CHECK([whether the C++ compiler works], [rw_cv_prog_cxx_works], [AC_LANG_PUSH([C++]) AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [rw_cv_prog_cxx_works=yes], [rw_cv_prog_cxx_works=no]) AC_LANG_POP([C++])]) ]) AC_PROG_CC AC_PROG_CXX rw_PROG_CXX_WORKS AC_PROG_INSTALL AC_LANG(C++) AC_PROG_LIBTOOL build_tools=yes AC_ARG_WITH(tools, AS_HELP_STRING(--with-tools, install libprotoident tools),[ if test "$withval" = yes then build_tools=yes else build_tools=no fi ]) AC_CHECK_LIB([trace], [trace_get_payload_length],,trace_found=0) if test "$build_tools" = yes; then AC_CHECK_LIB([flowmanager], [lfm_version_three],,lfm_found=0) fi AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/socket.h sys/time.h syslog.h unistd.h]) AC_CONFIG_FILES([Makefile lib/Makefile tools/Makefile tools/find_unknown/Makefile tools/protoident/Makefile tools/arff/Makefile lib/udp/Makefile lib/tcp/Makefile]) if test "$trace_found" = 0; then AC_MSG_ERROR(Required library libtrace 3.0.7 or later not found; use LDFLAGS to specify library location) fi if test "$lfm_found" = 0; then AC_MSG_ERROR(Required library libflowmanager not found; use LDFLAGS to specify library location) fi AM_CONDITIONAL([BUILD_LPI_TOOLS], [test "$build_tools" = yes]) AC_SUBST([ADD_LIBS]) AC_SUBST([ADD_LDFLAGS]) AC_SUBST([ADD_INCLS]) AC_SUBST([LTLIBOBJS]) AC_OUTPUT ================================================ FILE: debian/changelog ================================================ libprotoident (2.0.15-2) unstable; urgency=low * Rebuild package so tool binaries are compatible with latest libtrace. -- Shane Alcock Mon, 29 Mar 2021 13:40:13 +1300 libprotoident (2.0.15-1) unstable; urgency=low * New upstream release. * Added new API methods: lpi_get_category_by_protocol() and lpi_get_category_by_name(). * Improved rules for 6 protocols, including QUIC and Zoom * Added 5 new protocols. -- Shane Alcock Thu, 12 Nov 2019 12:00:00 +1300 libprotoident (2.0.14-1) unstable; urgency=low * New upstream release. * Added new API method: lpi_get_protocol_by_name(). * Fixed bug where lpi_print_category() would fail for the message queuing category. * Renamed "Roblox" to "Raknet" to better reflect the real underlying protocol. * Added new protocol category for educational applications. * Added 17 new application protocols. * Improved rules for a further 17 application protocols. -- Shane Alcock Wed, 20 Nov 2019 14:11:21 +1300 libprotoident (2.0.13) unstable; urgency=low * New upstream release * Fixed bug where RST payload was used for classification purposes. * Fixed errors in 4D, Heroes of the Storm and The Division rules. * Added new protocol category for message queuing applications. * Added 43 new application protocols. * Improved rules for a further 35 application protocols. -- Shane Alcock Tue, 09 Apr 2019 13:49:25 +1200 ================================================ FILE: debian/compat ================================================ 9 ================================================ FILE: debian/control ================================================ Source: libprotoident Priority: optional Maintainer: Shane Alcock Build-Depends: debhelper (>= 9), dh-autoreconf, libtrace4-dev, libflowmanager-dev Standards-Version: 4.1.3 Section: libs Homepage: http://research.wand.net.nz/software/libprotoident.php Package: libprotoident-dev Section: libdevel Architecture: any Depends: libprotoident (= ${binary:Version}), ${misc:Depends} Provides: libprotoident-dev Description: development headers for the libprotoident library This package contains development headers and other ancillary files for the libprotoident library. . libprotoident is a library that can perform traffic classification on each network flow observed via a packet capture process (including pcap trace files and many common live packet capture approaches). The classification is performed by examining the packet headers and first four bytes of application payload only, so can be used in environments where full payload capture is not possible. . libprotoident is developed by the WAND Network Research Group at Waikato University in New Zealand. Package: libprotoident Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Provides: libprotoident Description: C++ library for network traffic classification. libprotoident is a library that can perform traffic classification on each network flow observed via a packet capture process (including pcap trace files and many common live packet capture approaches). The classification is performed by examining the packet headers and first four bytes of application payload only, so can be used in environments where full payload capture is not possible. . libprotoident is developed by the WAND Network Research Group at Waikato University in New Zealand. Package: libprotoident-tools Section: net Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Provides: libprotoident-tools Description: example utilities that make use of the libprotoident library libprotoident is a library that can perform network traffic classification using minimal application payload. These tools are provided as working demonstrations of libprotoident and can be used to perform simple analytic tasks (i.e. identify flows belonging to a specific application). . libprotoident is developed by the WAND Network Research Group at Waikato University in New Zealand. ================================================ FILE: debian/copyright ================================================ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Libprotoident Source: http://research.wand.net.nz/software/libprotoident.php Files: * Copyright: 2019 The University of Waikato, Hamilton, New Zealand. License: LGPL-3 This package is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. . This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. . You should have received a copy of the GNU Lesser General Public License along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA . On Debian systems, the complete text of the GNU Lesser General Public License can be found in `/usr/share/common-licenses/LGPL-3'. ================================================ FILE: debian/libprotoident-dev.dirs ================================================ usr/lib usr/include ================================================ FILE: debian/libprotoident-dev.install ================================================ usr/include/libprotoident*.h usr/lib/libprotoident*.so usr/lib/libprotoident*.a ================================================ FILE: debian/libprotoident-tools.dirs ================================================ usr/bin ================================================ FILE: debian/libprotoident-tools.install ================================================ usr/bin/* usr/share/man/man1/* ================================================ FILE: debian/libprotoident.dirs ================================================ usr/lib ================================================ FILE: debian/libprotoident.install ================================================ usr/lib/libprotoident*.so.* ================================================ FILE: debian/rules ================================================ #!/usr/bin/make -f # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # Enable all hardening features, since traces are untrusted input. export DEB_BUILD_MAINT_OPTIONS = hardening=+all DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) CONFFLAGS = ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) CONFFLAGS += --build $(DEB_HOST_GNU_TYPE) else CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) endif configure: configure-stamp: configure dh_testdir dh_autoreconf ./configure $(CONFFLAGS) \ --prefix=/usr \ --with-tools=yes \ --mandir=\$${prefix}/share/man \ --infodir=\$${prefix}/share/info touch configure-stamp build: build-arch build-indep build-arch: build-stamp build-indep: build-stamp build-stamp: configure-stamp dh_testdir # Add here commands to compile the package. $(MAKE) touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp configure-stamp [ ! -f Makefile ] || $(MAKE) clean [ ! -f Makefile ] || $(MAKE) distclean rm -rf docs/doxygen dh_autoreconf_clean dh_clean install: build dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package into debian/tmp $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot #dh_installchangelogs ChangeLog dh_installchangelogs dh_installdocs dh_installexamples dh_installman dh_install --sourcedir=debian/tmp dh_link dh_strip dh_compress dh_fixperms dh_makeshlibs dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb -- -Zgzip binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install ================================================ FILE: debian/source/format ================================================ 3.0 (quilt) ================================================ FILE: debpkg-build.sh ================================================ #!/bin/bash set -x -e -o pipefail export DEBEMAIL='packaging@wand.net.nz' export DEBFULLNAME='WAND Packaging' export DEBIAN_FRONTEND=noninteractive export SOURCENAME=`echo ${GITHUB_REF##*/} | cut -d '-' -f 1` mk-build-deps -i -r -t 'apt-get -f -y --force-yes' dpkg-buildpackage -b -us -uc -rfakeroot -j4 ================================================ FILE: debpkg-setup.sh ================================================ #!/bin/bash set -x -e -o pipefail export DEBEMAIL='packaging@wand.net.nz' export DEBFULLNAME='WAND Packaging' export DEBIAN_FRONTEND=noninteractive export SOURCENAME=`echo ${GITHUB_REF##*/} | cut -d '-' -f 1` apt-get update apt-get install -y equivs devscripts dpkg-dev quilt curl apt-transport-https \ apt-utils ssl-cert ca-certificates gnupg lsb-release debhelper git \ pkg-config curl -1sLf 'https://dl.cloudsmith.io/public/wand/libwandio/cfg/setup/bash.deb.sh' | bash curl -1sLf 'https://dl.cloudsmith.io/public/wand/libwandder/cfg/setup/bash.deb.sh' | bash curl -1sLf 'https://dl.cloudsmith.io/public/wand/libtrace/cfg/setup/bash.deb.sh' | bash curl -1sLf 'https://dl.cloudsmith.io/public/wand/libflowmanager/cfg/setup/bash.deb.sh' | bash DISTRO=$(lsb_release -sc) case ${DISTRO} in jessie | xenial | stretch ) curl -1sLf 'https://dl.cloudsmith.io/public/wand/dpdk-wand/cfg/setup/bash.deb.sh' | bash ;; esac apt-get update apt-get upgrade -y ================================================ FILE: lib/Makefile.am ================================================ SUBDIRS=tcp udp lib_LTLIBRARIES=libprotoident.la include_HEADERS=libprotoident.h libprotoident_la_SOURCES=libprotoident.h libprotoident.cc \ proto_common.cc proto_common.h \ proto_manager.cc proto_manager.h INCLUDES=@ADD_INCLS@ libprotoident_la_LIBADD = @ADD_LIBS@ tcp/libprotoident_tcp.la \ udp/libprotoident_udp.la libprotoident_la_LDFLAGS = @ADD_LDFLAGS@ -version-info 4:0:2 libprotoident_la_CPPFLAGS = -Werror ================================================ FILE: lib/libprotoident.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #define __STDC_FORMAT_MACROS #define __STDC_LIMIT_MACROS #include #include #include #include #include #include #include #include #include "libprotoident.h" #include "proto_manager.h" bool init_called = false; LPIModuleMap TCP_protocols; LPIModuleMap UDP_protocols; lpi_module_t *lpi_icmp = NULL; lpi_module_t *lpi_unsupported = NULL; lpi_module_t *lpi_unknown_tcp = NULL; lpi_module_t *lpi_unknown_udp = NULL; static LPINameMap lpi_names; static LPIProtocolMap lpi_protocols; static LPICategoryMap lpi_categories; static LPICategoryProtocolMap lpi_category_protocols; static int seq_cmp (uint32_t seq_a, uint32_t seq_b) { if (seq_a == seq_b) return 0; if (seq_a > seq_b) return (int)(seq_a - seq_b); else /* WRAPPING */ return (int)(UINT32_MAX - ((seq_b - seq_a) - 1)); } int lpi_init_library() { if (init_called) { fprintf(stderr, "WARNING: lpi_init_library has already been called\n"); return 0; } if (register_tcp_protocols(&TCP_protocols) == -1) return -1; if (register_udp_protocols(&UDP_protocols) == -1) return -1; init_other_protocols(&lpi_names, &lpi_protocols, &lpi_category_protocols); register_names(&TCP_protocols, &lpi_names, &lpi_protocols, &lpi_category_protocols); register_names(&UDP_protocols, &lpi_names, &lpi_protocols, &lpi_category_protocols); register_category_names(&lpi_categories); init_called = true; if (TCP_protocols.empty() && UDP_protocols.empty()) { fprintf(stderr, "WARNING: No protocol modules loaded\n"); return -1; } return 0; } void lpi_free_library() { free_protocols(&TCP_protocols); free_protocols(&UDP_protocols); if (lpi_icmp != NULL) { delete lpi_icmp; lpi_icmp = NULL; } if (lpi_unsupported != NULL) { delete lpi_unsupported; lpi_unsupported = NULL; } if (lpi_unknown_tcp != NULL) { delete lpi_unknown_tcp; lpi_unknown_tcp = NULL; } if (lpi_unknown_udp != NULL) { delete lpi_unknown_udp; lpi_unknown_udp = NULL; } init_called = false; } void lpi_init_data(lpi_data_t *data) { data->payload[0] = 0; data->payload[1] = 0; data->seen_syn[0] = false; data->seen_syn[1] = false; data->seqno[0] = 0; data->seqno[1] = 0; data->observed[0] = 0; data->observed[1] = 0; data->server_port = 0; data->client_port = 0; data->trans_proto = 0; data->payload_len[0] = 0; data->payload_len[1] = 0; data->ips[0] = 0; data->ips[1] = 0; } static int update_tcp_flow(lpi_data_t *data, libtrace_tcp_t *tcp, uint8_t dir, uint32_t rem, uint32_t psize) { uint32_t seq = 0; if (rem < sizeof(libtrace_tcp_t)) return 0; if (tcp->rst) return 0; if (data->server_port == 0) { data->server_port = ntohs(tcp->dest); data->client_port = ntohs(tcp->source); } seq = ntohl(tcp->seq); if (tcp->syn && data->payload_len[dir] == 0) { data->seqno[dir] = seq + 1; data->seen_syn[dir] = true; } /* Ok, we've got some payload but we never saw the SYN for this * direction. What do we do? * * Current idea: just assume this is the first payload bearing * packet. Better than running around with an uninitialised seqno */ if (data->seen_syn[dir] == false && psize > 0) { data->seqno[dir] = seq; data->seen_syn[dir] = true; } if (seq_cmp(seq, data->seqno[dir]) != 0) return 0; //data->seqno[dir] = seq; return 1; } static int update_udp_flow(lpi_data_t *data, libtrace_udp_t *udp, uint32_t rem) { if (rem < sizeof(libtrace_udp_t)) return 0; if (data->server_port == 0) { data->server_port = ntohs(udp->dest); data->client_port = ntohs(udp->source); } return 1; } int lpi_update_data(libtrace_packet_t *packet, lpi_data_t *data, uint8_t dir) { char *payload = NULL; uint32_t psize = 0; uint32_t rem = 0; uint8_t proto = 0; void *transport; uint32_t four_bytes; libtrace_ip_t *ip = NULL; //tcp = trace_get_tcp(packet); psize = trace_get_payload_length(packet); /* Don't bother if we've observed 32k of data - the first packet must * surely been within that. This helps us avoid issues with sequence * number wrapping when doing the reordering check below */ if (data->observed[dir] > 32 * 1024) return 0; data->observed[dir] += psize; /* If we're TCP, we have to wait to check that we haven't been * reordered */ if (data->trans_proto != 6 && data->payload_len[dir] != 0) return 0; transport = trace_get_transport(packet, &proto, &rem); if (data->trans_proto == 0) data->trans_proto = proto; if (transport == NULL || rem == 0) return 0; if (proto == 6) { if (update_tcp_flow(data, (libtrace_tcp_t *)transport, dir, rem, psize) == 0) return 0; payload = (char *)trace_get_payload_from_tcp( (libtrace_tcp_t *)transport, &rem); } if (proto == 17) { if (update_udp_flow(data, (libtrace_udp_t *)transport, rem) == 0) return 0; payload = (char *)trace_get_payload_from_udp( (libtrace_udp_t *)transport, &rem); } ip = trace_get_ip(packet); if (payload == NULL) return 0; if (psize <= 0) return 0; four_bytes = (*(uint32_t *)payload); if (psize < 4) { four_bytes = (ntohl(four_bytes)) >> (8 * (4 - psize)); four_bytes = htonl(four_bytes << (8 * (4 - psize))); } data->payload[dir] = four_bytes; data->payload_len[dir] = psize; if (ip != NULL && data->ips[0] == 0) { if (dir == 0) { data->ips[0] = ip->ip_src.s_addr; data->ips[1] = ip->ip_dst.s_addr; } else { data->ips[1] = ip->ip_src.s_addr; data->ips[0] = ip->ip_dst.s_addr; } } return 1; } static lpi_module_t *test_protocol_list(LPIModuleList *ml, lpi_data_t *data) { LPIModuleList::iterator l_it; /* Turns out naively looping through the modules is quicker * than trying to do intelligent stuff with threads. Most * callbacks complete very quickly so threading overhead is a * major problem */ for (l_it = ml->begin(); l_it != ml->end(); l_it ++) { lpi_module_t *module = *l_it; /* To save time, I'm going to break on the first successful * match. A threaded version would wait for all the modules * to run, storing all successful results in a list of some * sort and selecting an appropriate result from there. */ if (module->lpi_callback(data, module)) return module; } return NULL; } static lpi_module_t *guess_protocol(LPIModuleMap *modmap, lpi_data_t *data) { lpi_module_t *proto = NULL; LPIModuleMap::iterator m_it; /* Deal with each priority in turn - want to match higher priority * rules first. */ for (m_it = modmap->begin(); m_it != modmap->end(); m_it ++) { LPIModuleList *ml = m_it->second; proto = test_protocol_list(ml, data); if (proto != NULL) break; } return proto; } lpi_module_t *lpi_guess_protocol(lpi_data_t *data) { lpi_module_t *p = NULL; if (!init_called) { fprintf(stderr, "lpi_init_library was never called - cannot guess the protocol\n"); return NULL; } switch(data->trans_proto) { case TRACE_IPPROTO_ICMP: return lpi_icmp; case TRACE_IPPROTO_TCP: p = guess_protocol(&TCP_protocols, data); if (p == NULL) p = lpi_unknown_tcp; return p; case TRACE_IPPROTO_UDP: p = guess_protocol(&UDP_protocols, data); if (p == NULL) p = lpi_unknown_udp; return p; default: return lpi_unsupported; } return p; } lpi_category_t lpi_categorise(lpi_module_t *module) { if (module == NULL) return LPI_CATEGORY_NO_CATEGORY; return module->category; } const char *lpi_print_category(lpi_category_t category) { switch(category) { case LPI_CATEGORY_WEB: return "Web"; case LPI_CATEGORY_MAIL: return "Mail"; case LPI_CATEGORY_CHAT: return "Chat"; case LPI_CATEGORY_P2P: return "P2P"; case LPI_CATEGORY_P2P_STRUCTURE: return "P2P_Structure"; case LPI_CATEGORY_KEY_EXCHANGE: return "Key_Exchange"; case LPI_CATEGORY_ECOMMERCE: return "ECommerce"; case LPI_CATEGORY_GAMING: return "Gaming"; case LPI_CATEGORY_ENCRYPT: return "Encryption"; case LPI_CATEGORY_MONITORING: return "Measurement"; case LPI_CATEGORY_NEWS: return "News"; case LPI_CATEGORY_MALWARE: return "Malware"; case LPI_CATEGORY_SECURITY: return "Security"; case LPI_CATEGORY_ANTISPAM: return "Antispam"; case LPI_CATEGORY_VOIP: return "VOIP"; case LPI_CATEGORY_TUNNELLING: return "Tunnelling"; case LPI_CATEGORY_NAT: return "NAT_Traversal"; case LPI_CATEGORY_STREAMING: return "Streaming"; case LPI_CATEGORY_SERVICES: return "Services"; case LPI_CATEGORY_DATABASES: return "Databases"; case LPI_CATEGORY_FILES: return "File_Transfer"; case LPI_CATEGORY_REMOTE: return "Remote_Access"; case LPI_CATEGORY_TELCO: return "Telco_Services"; case LPI_CATEGORY_P2PTV: return "P2PTV"; case LPI_CATEGORY_RCS: return "Revision_Control"; case LPI_CATEGORY_LOGGING: return "Logging"; case LPI_CATEGORY_PRINTING: return "Printing"; case LPI_CATEGORY_TRANSLATION: return "Translation"; case LPI_CATEGORY_CDN: return "CDN"; case LPI_CATEGORY_CLOUD: return "Cloud"; case LPI_CATEGORY_NOTIFICATION: return "Notification"; case LPI_CATEGORY_SERIALISATION: return "Serialisation"; case LPI_CATEGORY_BROADCAST: return "Broadcast"; case LPI_CATEGORY_LOCATION: return "Location"; case LPI_CATEGORY_CACHING: return "Caching"; case LPI_CATEGORY_ICS: return "ICS"; case LPI_CATEGORY_MOBILE_APP: return "Mobile App"; case LPI_CATEGORY_IPCAMERAS: return "IP Cameras"; case LPI_CATEGORY_EDUCATIONAL: return "Educational"; case LPI_CATEGORY_MESSAGE_QUEUE: return "Message_Queuing"; case LPI_CATEGORY_ICMP: return "ICMP"; case LPI_CATEGORY_MIXED: return "Mixed"; case LPI_CATEGORY_NOPAYLOAD: return "No_Payload"; case LPI_CATEGORY_UNKNOWN: return "Unknown"; case LPI_CATEGORY_UNSUPPORTED: return "Unsupported"; case LPI_CATEGORY_NO_CATEGORY: return "Uncategorised"; case LPI_CATEGORY_LAST: return "Invalid_Category"; } return "Invalid_Category"; } const char *lpi_print(lpi_protocol_t proto) { LPINameMap::iterator it; it = lpi_names.find(proto); if (it == lpi_names.end()) { return "NULL"; } return (it->second); } lpi_protocol_t lpi_get_protocol_by_name(char *name) { LPIProtocolMap::iterator it; it = lpi_protocols.find(name); if (it == lpi_protocols.end()) { return LPI_PROTO_UNKNOWN; } return (it->second); } lpi_category_t lpi_get_category_by_name(char *name) { LPICategoryMap::iterator it; it = lpi_categories.find(name); if (it == lpi_categories.end()) { return LPI_CATEGORY_UNKNOWN; } return (it->second); } lpi_category_t lpi_get_category_by_protocol(lpi_protocol_t protocol) { LPICategoryProtocolMap::iterator it; it = lpi_category_protocols.find(protocol); if (it == lpi_category_protocols.end()) { return LPI_CATEGORY_UNKNOWN; } return (it->second); } bool lpi_is_protocol_inactive(lpi_protocol_t proto) { LPINameMap::iterator it; it = lpi_names.find(proto); if (it == lpi_names.end()) { return true; } return false; } ================================================ FILE: lib/libprotoident.h ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #ifndef LIBPROTOIDENT_H_ #define LIBPROTOIDENT_H_ #include #include #include #if __GNUC__ >= 3 #ifndef PRINTF # define DEPRECATED __attribute__((deprecated)) # define SIMPLE_FUNCTION __attribute__((pure)) # define UNUSED __attribute__((unused)) # define PACKED __attribute__((packed)) # define PRINTF(formatpos,argpos) __attribute__((format(printf,formatpos,argpos))) #endif #else #ifndef PRINTF # define DEPRECATED # define SIMPLE_FUNCTION # define UNUSED # define PACKED # define PRINTF(formatpos,argpos) #endif #endif #define DEFAULT_MAXTHREADS 10 #ifdef __cplusplus extern "C" { #endif /* Protocol categories - most l7 protocols fall into a broader category that * describes what they are used for, e.g. P2P, Web, Mail etc. */ typedef enum { LPI_CATEGORY_WEB, /* HTTP-based protocols */ LPI_CATEGORY_CHAT, /* Instant messaging and chatrooms */ LPI_CATEGORY_MAIL, /* E-mail */ LPI_CATEGORY_P2P, /* Peer-to-peer uploads and downloads */ LPI_CATEGORY_P2P_STRUCTURE, /* Maintenance of P2P networks */ LPI_CATEGORY_KEY_EXCHANGE, /* Protocols used to exchange and manage cryptographic keys, e.g. ISAKMP */ LPI_CATEGORY_ECOMMERCE, /* Financial transaction protocols */ LPI_CATEGORY_GAMING, /* Game protocols */ LPI_CATEGORY_ENCRYPT, /* Encrypted traffic that is not clearly part of another category */ LPI_CATEGORY_MONITORING, /* Network measurement / monitoring */ LPI_CATEGORY_NEWS, /* Newsgroup protocols, e.g. NNTP */ LPI_CATEGORY_MALWARE, /* Viruses, trojans etc. */ LPI_CATEGORY_SECURITY, /* Antivirus and firewall updates */ LPI_CATEGORY_ANTISPAM, /* Anti-spam software update protocols */ LPI_CATEGORY_VOIP, /* Voice chat and Internet telephony protocols */ LPI_CATEGORY_TUNNELLING, /* Tunnelling protocols */ LPI_CATEGORY_NAT, /* NAT traversal protocols */ LPI_CATEGORY_STREAMING, /* Streaming media protocols */ LPI_CATEGORY_SERVICES, /* Basic services, e.g. DNS, NTP */ LPI_CATEGORY_DATABASES, /* Database remote access protocols */ LPI_CATEGORY_FILES, /* Non-P2P file transfer protocols */ LPI_CATEGORY_REMOTE, /* Remote access, e.g. SSH, telnet */ LPI_CATEGORY_TELCO, /* Telco services aside from VOIP, e.g SMS protocols */ LPI_CATEGORY_P2PTV, /* P2P TV, e.g. PPLive */ LPI_CATEGORY_RCS, /* Revision Control */ LPI_CATEGORY_LOGGING, /* Logging */ LPI_CATEGORY_PRINTING, /* Network printing */ LPI_CATEGORY_TRANSLATION, /* Language translation */ LPI_CATEGORY_CDN, /* CDN protocols, e.g. Akamai */ LPI_CATEGORY_CLOUD, /* Cloud computing/storage protocols */ LPI_CATEGORY_NOTIFICATION, /* Notification / messaging protocols */ LPI_CATEGORY_SERIALISATION, /* Transfer of programming "objects" */ LPI_CATEGORY_BROADCAST, /* Protocols usually broadcast to the local network */ LPI_CATEGORY_LOCATION, /* Location-related services / GPS */ LPI_CATEGORY_CACHING, /* Proxy cache protocols and similar */ LPI_CATEGORY_MOBILE_APP, /* Mobile apps that don't fit any other category */ LPI_CATEGORY_ICS, /* Industrial control system protocols */ LPI_CATEGORY_IPCAMERAS, /* IP Surveillance Camera protocols */ LPI_CATEGORY_MESSAGE_QUEUE, /* Message queuing protocols */ LPI_CATEGORY_EDUCATIONAL, /* Educational applications, e.g. virtual classrooms */ LPI_CATEGORY_ICMP, /* ICMP */ LPI_CATEGORY_MIXED, /* Different protos in each direction */ LPI_CATEGORY_NOPAYLOAD, /* No payload observed */ LPI_CATEGORY_UNSUPPORTED, /* Transport protocol unsupported */ LPI_CATEGORY_UNKNOWN, /* Protocol could not be identified */ LPI_CATEGORY_NO_CATEGORY, /* Protocol has not been placed into a category yet */ LPI_CATEGORY_LAST /* Must always be last */ } lpi_category_t; typedef enum { /* TCP Protocols */ LPI_PROTO_HTTP, LPI_PROTO_SMTP, LPI_PROTO_BITTORRENT, LPI_PROTO_IRC, LPI_PROTO_NCSOFT, /* NCSoft proprietary protocol */ LPI_PROTO_DC, /* DirectConnect */ LPI_PROTO_EMULE, LPI_PROTO_GNUTELLA, LPI_PROTO_SSH, LPI_PROTO_HTTPS, LPI_PROTO_RAZOR, /* Razor database updates */ LPI_PROTO_POP3, LPI_PROTO_SSL, /* SSL that isn't HTTPS */ LPI_PROTO_MSN, LPI_PROTO_DNS, LPI_PROTO_IMAP, LPI_PROTO_RTSP, LPI_PROTO_ID, /* Identification protocol */ LPI_PROTO_YAHOO, LPI_PROTO_ICQ, LPI_PROTO_TELNET, LPI_PROTO_RDP, /* Windows remote desktop protocol */ LPI_PROTO_TDS, /* MS SQL Server protocol */ LPI_PROTO_RPC_SCAN, /* Port 135 exploit attempt */ LPI_PROTO_SMB, /* Server Message Block protocol e.g. samba */ LPI_PROTO_WARCRAFT3, LPI_PROTO_ETRUST, /* Updates for the eTrust virus scanner */ LPI_PROTO_FTP_CONTROL, /* FTP control e.g. port 21 or 2121 */ LPI_PROTO_FTP_DATA, LPI_PROTO_EYE, /* Yahoo Game Server Browser */ LPI_PROTO_ARES, /* Ares peer-to-peer protocol */ LPI_PROTO_NNTP, /* Newsfeeds */ LPI_PROTO_NAPSTER, LPI_PROTO_BNCS, /* Battle.net Chat Server */ LPI_PROTO_RFB, /* Remote Frame Buffer protocol */ LPI_PROTO_YAHOO_WEBCAM,/* Webcam over Yahoo Messenger */ LPI_PROTO_ICA, /* Citrix ICA */ LPI_PROTO_NETBIOS, LPI_PROTO_KMS, /* Possibly a vista activation service */ LPI_PROTO_MS_DS, LPI_PROTO_SIP, /* Session Initiation Protocol*/ LPI_PROTO_MZINGA, LPI_PROTO_GOKUCHAT, LPI_PROTO_XUNLEI, LPI_PROTO_DXP, LPI_PROTO_HAMACHI, LPI_PROTO_BLIZZARD, LPI_PROTO_MSNV, /* MSN Voice */ LPI_PROTO_BITEXT, /* BitTorrent extensions */ LPI_PROTO_MITGLIEDER, /* Mitglieder trojan */ LPI_PROTO_TOR, /* TOR (The Onion Router) */ LPI_PROTO_MYSQL, LPI_PROTO_HTTP_TUNNEL, /* Tunnelling via HTTP */ LPI_PROTO_RSYNC, LPI_PROTO_NOTES_RPC, /* Lotus Notes RPC (Domino) */ LPI_PROTO_AZUREUS, /* Azureus Extension */ LPI_PROTO_PANDO, /* Pando P2P protocol */ LPI_PROTO_FLASH, /* Flash Player specific behaviour */ LPI_PROTO_STEAM, /* Steam TCP download, i.e. downloading games */ LPI_PROTO_TRACKMANIA, /* Trackmania control protocol */ LPI_PROTO_CONQUER, /* Conquer Online game */ LPI_PROTO_RTMP, /* Adobe RTMP */ LPI_PROTO_TIP, /* Transaction Internet Protocol */ LPI_PROTO_NONSTANDARD_HTTP, /* HTTP on unconventional port numbers */ LPI_PROTO_HARVEYS, /* Photo transfers for Harveys Real Estate */ LPI_PROTO_SHOUTCAST, LPI_PROTO_HTTP_BADPORT, /* HTTP over port 443, leading to failure */ LPI_PROTO_POSTGRESQL, /* Postgresql protocol */ LPI_PROTO_WOW, /* World of Warcraft */ LPI_PROTO_M4U, /* Message4U (Aus SMS service) */ LPI_PROTO_RBLS, /* Realtime Block List updates */ LPI_PROTO_OPENVPN, LPI_PROTO_TELECOMKEY, /* Proto used to talk to telecomkey.com */ LPI_PROTO_IMAPS, /* IMAP over SSL */ LPI_PROTO_MSNC, /* MSN Client Protocol */ LPI_PROTO_YAHOO_ERROR, /* Yahoo method of dealing with HTTP errors */ LPI_PROTO_IMESH, /* iMesh */ LPI_PROTO_PPTP, /* MS Tunnelling protocol */ LPI_PROTO_AFP, /* Apple Filing Protocol */ LPI_PROTO_PDBOX, /* Korean P2P TV protocol */ LPI_PROTO_EA_GAMES, /* EA Games protocol */ LPI_PROTO_ZYNGA, /* Protocol used by Zynga games */ LPI_PROTO_CLUBBOX, /* Another Korean file sharing protocol */ LPI_PROTO_WINMX, /* WinMX */ LPI_PROTO_INVALID_BT, /* Bittorrent in one direction but not other */ LPI_PROTO_WEBLOGIC, /* Weblogic server */ LPI_PROTO_INVALID_HTTP, /* HTTP server sending raw HTML */ LPI_PROTO_COD_WAW, /* Call of Duty: World at War TCP */ LPI_PROTO_MP2P, LPI_PROTO_SVN, LPI_PROTO_SOCKS5, LPI_PROTO_SOCKS4, LPI_PROTO_INVALID_SMTP, LPI_PROTO_MMS, /* Microsoft Media Server */ LPI_PROTO_CISCO_VPN, /* Cisco VPN protocol */ LPI_PROTO_WEB_JUNK, /* Clients communicating with web servers using non-HTTP */ LPI_PROTO_CVS, LPI_PROTO_LDAP, /* LDAP */ LPI_PROTO_INVALID_POP3, /* POP commands send to an SMTP server */ LPI_PROTO_TEAMVIEWER, LPI_PROTO_XMPP, /* a.k.a. Jabber */ LPI_PROTO_SECONDLIFE, /* SecondLife over TCP */ LPI_PROTO_KASEYA, LPI_PROTO_KASPERSKY, LPI_PROTO_JEDI, /* Citrix Jedi */ LPI_PROTO_CGP, /* Citrix CGP */ LPI_PROTO_YOUKU, LPI_PROTO_STUN, LPI_PROTO_XYMON, LPI_PROTO_MUNIN, LPI_PROTO_TROJAN_WIN32_GENERIC_SB, LPI_PROTO_PALTALK, LPI_PROTO_ZABBIX, LPI_PROTO_AKAMAI, LPI_PROTO_GAMESPY, LPI_PROTO_WUALA, LPI_PROTO_TROJAN_ZEROACCESS, LPI_PROTO_DVRNS, LPI_PROTO_CHATANGO, LPI_PROTO_OMEGLE, LPI_PROTO_TELNET_EXPLOIT, LPI_PROTO_POP3S, /* POP3 over TLS/SSL */ LPI_PROTO_PSN_STORE, LPI_PROTO_SKYPE_TCP, /* Skype TCP sessions */ LPI_PROTO_APPLE_PUSH, /* Apple push notifications */ LPI_PROTO_XMPPS, /* XMPP over TLS/SSL */ LPI_PROTO_SMTPS, /* Legacy Secure SMTP */ LPI_PROTO_NNTPS, /* NNTP over TLS/SSL */ LPI_PROTO_JAVA, /* Serialised Java Objects */ LPI_PROTO_IPOP, /* IP over P2P */ LPI_PROTO_SPOTIFY, LPI_PROTO_RUNESCAPE, LPI_PROTO_WHOIS, LPI_PROTO_VIBER, LPI_PROTO_FRING, LPI_PROTO_PALRINGO, LPI_PROTO_CRYPTIC, /* Games by Cryptic */ LPI_PROTO_SUPL, LPI_PROTO_MINECRAFT, LPI_PROTO_TPKT, LPI_PROTO_QVOD, LPI_PROTO_KIK, LPI_PROTO_WHATSAPP, LPI_PROTO_WECHAT, LPI_PROTO_FUNSHION, LPI_PROTO_BTSYNC, LPI_PROTO_SPEEDTEST, LPI_PROTO_GIT, LPI_PROTO_DUELING_NETWORK, LPI_PROTO_LINE, LPI_PROTO_AMP, LPI_PROTO_SPDY, LPI_PROTO_YAHOO_GAMES, LPI_PROTO_DELL_BACKUP, LPI_PROTO_REVOLVER_NBLBT, LPI_PROTO_CRASHPLAN, LPI_PROTO_CLASH_OF_CLANS, LPI_PROTO_TRION, LPI_PROTO_MONGO, LPI_PROTO_LLP2P, LPI_PROTO_HEARTHSTONE, LPI_PROTO_DIABLO3, LPI_PROTO_CACAOWEB, LPI_PROTO_TAOBAO, /* Custom protocol seen on Taobao CDN */ LPI_PROTO_TERA, LPI_PROTO_SILKROADONLINE, /* Korean MMO */ LPI_PROTO_GOOGLE_HANGOUTS, LPI_PROTO_HOLA, LPI_PROTO_GUILDWARS2, LPI_PROTO_QQ, LPI_PROTO_TETRISONLINE, LPI_PROTO_TWITCH_IRC, /* IRC specific to twitch.tv */ LPI_PROTO_QQLIVE, LPI_PROTO_TENCENT_GAMES, /* Games operated by Tencent */ LPI_PROTO_VODLOCKER, LPI_PROTO_TELEGRAM, LPI_PROTO_XUNLEI_ACCEL, LPI_PROTO_360SAFEGUARD, /* Chinese anti-virus */ LPI_PROTO_NORTON_BACKUP, LPI_PROTO_BADBAIDU, /* Weird 1 byte flows from Baidu browser */ LPI_PROTO_KAKAO, LPI_PROTO_WEIBO, LPI_PROTO_TENSAFE, LPI_PROTO_KANKAN, LPI_PROTO_AIRDROID, LPI_PROTO_KUAIBO, LPI_PROTO_DIANPING, LPI_PROTO_XIAMI, LPI_PROTO_QQDOWNLOAD, LPI_PROTO_ZERO_FACEBOOK, LPI_PROTO_FINALFANTASY_XIV, LPI_PROTO_FACEBOOK_MESSENGER, LPI_PROTO_YY, LPI_PROTO_NETCAT_CCTV, LPI_PROTO_ZOOM, LPI_PROTO_S7COMM, LPI_PROTO_MAXICLOUD, LPI_PROTO_GLUPTEBA, LPI_PROTO_WNS, LPI_PROTO_PANDATV, LPI_PROTO_FACEBOOK_TURN, LPI_PROTO_DESTINY, LPI_PROTO_QCLOUD_ILVB, LPI_PROTO_BITCOIN, LPI_PROTO_LIFEFORGE, LPI_PROTO_ACESTREAM, LPI_PROTO_MAPLESTORY_CHINA, LPI_PROTO_NDT_TPUT, LPI_PROTO_RELAY, LPI_PROTO_DOUYU, LPI_PROTO_IDRIVE_SYNC, LPI_PROTO_TWITCASTING, LPI_PROTO_THE_DIVISION, LPI_PROTO_BLACKDESERT, LPI_PROTO_REALVNC, LPI_PROTO_DOGECOIN, LPI_PROTO_FUCKCOIN, LPI_PROTO_OURWORLD, LPI_PROTO_GRAAL_ONLINE_ERA, LPI_PROTO_APPEAR_IN, LPI_PROTO_VAINGLORY, LPI_PROTO_WEIQI, LPI_PROTO_4D, LPI_PROTO_TANKIX, LPI_PROTO_IPSHARKK, LPI_PROTO_NET_MFP, LPI_PROTO_SPEEDIN, LPI_PROTO_CROSSFIRE, LPI_PROTO_DASH, LPI_PROTO_AIRMEDIA, LPI_PROTO_GIOP, LPI_PROTO_VPN_UNLIMITED, LPI_PROTO_TENFIVECOIN, LPI_PROTO_BAOFENG, LPI_PROTO_TALESRUNNER, LPI_PROTO_ANTCOIN, LPI_PROTO_FBCDN_SSL, LPI_PROTO_SAPROUTER, LPI_PROTO_FLIGGY, LPI_PROTO_SMITE, LPI_PROTO_VPNROBOT, LPI_PROTO_VMWARE, LPI_PROTO_DOUYU_CHAT, LPI_PROTO_JX3ONLINE, LPI_PROTO_LITECOIN, LPI_PROTO_STRATUM, LPI_PROTO_WIZARD101, LPI_PROTO_KINGOFGLORY, LPI_PROTO_SAS_ZOMBIE_ASSAULT_4, LPI_PROTO_DNF, LPI_PROTO_IHEXIN, LPI_PROTO_NAVER_P2P, LPI_PROTO_GCAFE_UPDATER, LPI_PROTO_BWSYNC, LPI_PROTO_TANKIONLINE, LPI_PROTO_REALMOFTHEMADGOD, LPI_PROTO_PATHOFEXILE, LPI_PROTO_SSJJ, LPI_PROTO_SPEEDIFY, LPI_PROTO_NSQ, LPI_PROTO_SKYFORGE, LPI_PROTO_HOTS, LPI_PROTO_NOMACHINE, LPI_PROTO_QQSPEEDMOBILE, LPI_PROTO_DAHUA, LPI_PROTO_UTHERVERSE, LPI_PROTO_300_HEROES, LPI_PROTO_FILENORI, LPI_PROTO_IPFS, LPI_PROTO_REMOTE_MANIPULATOR, LPI_PROTO_WEBEX_STUN, LPI_PROTO_RRTV, LPI_PROTO_RABBITMQ, LPI_PROTO_ICEP, LPI_PROTO_BEAM, LPI_PROTO_VHDP2P, LPI_PROTO_CLASSIN, LPI_PROTO_TRANSOCKS, LPI_PROTO_RAGNAROK_ONLINE, LPI_PROTO_ETHERNETIP, /* UDP Protocols */ LPI_PROTO_UDP, LPI_PROTO_UDP_SIP, LPI_PROTO_UDP_BTDHT, LPI_PROTO_UDP_GNUTELLA, LPI_PROTO_UDP_DNS, LPI_PROTO_UDP_DHCP, LPI_PROTO_UDP_QUAKE, LPI_PROTO_UDP_STEAM, LPI_PROTO_UDP_STEAM_FRIENDS, LPI_PROTO_UDP_STEAM_INHOMEBROADCAST, LPI_PROTO_UDP_WIN_MESSAGE, LPI_PROTO_UDP_GAMESPY, LPI_PROTO_UDP_EMULE, LPI_PROTO_UDP_EYE, LPI_PROTO_UDP_RTP, LPI_PROTO_UDP_ETHERNETIP, LPI_PROTO_UDP_CIP_IO, /* Common industrial protocol IO */ LPI_PROTO_UDP_MSN_VIDEO, LPI_PROTO_UDP_COD, /* Call of Duty game protocol */ LPI_PROTO_UDP_NTP, LPI_PROTO_UDP_MP2P, /* MP2P protocol (Piolet, Manolito etc.) */ LPI_PROTO_UDP_SPAMFIGHTER, /* SpamFighter */ LPI_PROTO_UDP_TRACEROUTE, LPI_PROTO_UDP_SECONDLIFE, LPI_PROTO_UDP_HL, /* Halflife, includes derivatives such as * CounterStrike and Garry's Mod */ LPI_PROTO_UDP_XLSP, /* XLSP - Xbox Live */ LPI_PROTO_UDP_DEMONWARE, /* Company that does game networking */ LPI_PROTO_UDP_IMESH, /* iMesh */ LPI_PROTO_UDP_OPASERV, /* Opaserv worm */ LPI_PROTO_UDP_STUN, /* STUN NAT traversal */ LPI_PROTO_UDP_SQLEXP, /* MS SQL Server worm, called SQLExp */ LPI_PROTO_UDP_MSN_CACHE, /* MSN cache callback protocol */ LPI_PROTO_UDP_DIABLO2, /* Diablo 2 game protocol */ LPI_PROTO_UDP_IPV6, /* IPv6 tunnelled directly over UDP */ LPI_PROTO_UDP_ORBIT, /* Orbit downloader */ LPI_PROTO_UDP_TEREDO, LPI_PROTO_UDP_KADEMLIA, /* Unknown flavour of kademlia */ LPI_PROTO_UDP_PANDO, /* Pando DHT and Peer Exchange */ LPI_PROTO_UDP_ESP, /* ESP/IPSec encapsulated in UDP */ LPI_PROTO_UDP_PSN, /* Playstation Network */ LPI_PROTO_UDP_REAL, /* RDT - the Real Data Transport protocol */ LPI_PROTO_UDP_GNUTELLA2, /* Gnutella2 */ LPI_PROTO_UDP_PYZOR, /* Python implementation of Razor */ LPI_PROTO_UDP_SKYPE, LPI_PROTO_UDP_ISAKMP, /* ref: RFC 2408 */ LPI_PROTO_UDP_SNMP, LPI_PROTO_UDP_BACKWEB, /* BackWeb Polite Protocol */ LPI_PROTO_UDP_STARCRAFT, LPI_PROTO_UDP_XFIRE_P2P, /* Xfire P2P protocol */ LPI_PROTO_UDP_THQ, /* Protocol used by THQ games */ LPI_PROTO_UDP_NEWERTH, /* Heroes of Newerth */ LPI_PROTO_UDP_LINKPROOF, /* Linkproof device packets */ LPI_PROTO_UDP_WORM_22105, /* Chinese worm that uses port 22105 */ LPI_PROTO_UDP_QQ, /* Tencent QQ */ LPI_PROTO_UDP_SLP, /* Service Location Protocol, RFC 2608 */ LPI_PROTO_UDP_ESO, /* Games using Ensemble Studios Online */ LPI_PROTO_UDP_SSDP, LPI_PROTO_UDP_NETBIOS, /* Netbios lookup */ LPI_PROTO_UDP_CP_RDP, /* Checkpoint RDP */ LPI_PROTO_UDP_VENTRILO, /* Ventrilo VoiceChat */ LPI_PROTO_UDP_MTA, /* Multitheftauto */ LPI_PROTO_UDP_PPLIVE, LPI_PROTO_UDP_JEDI_ACADEMY, /* Jedi Academy game */ LPI_PROTO_UDP_MOH, /* Medal of Honor game */ LPI_PROTO_UDP_TREMULOUS, /* Tremulous - free OSS FPS */ LPI_PROTO_UDP_VIVOX, /* Vivox voice chat */ LPI_PROTO_UDP_IPMSG, /* IPMsg messenger */ LPI_PROTO_UDP_TEAMSPEAK, LPI_PROTO_UDP_DC, /* DirectConnect UDP commands */ LPI_PROTO_UDP_FREECHAL, /* FreeChal P2P */ LPI_PROTO_UDP_XUNLEI, LPI_PROTO_UDP_KAZAA, LPI_PROTO_UDP_NORTON, /* Norton Antivirus probe */ LPI_PROTO_UDP_CISCO_VPN, /* Cisco VPN (port 10000) */ LPI_PROTO_UDP_RTCP, LPI_PROTO_UDP_UNREAL, /* Unreal server query protocol */ LPI_PROTO_UDP_TFTP, LPI_PROTO_UDP_GARENA, /* A gaming platform */ LPI_PROTO_UDP_PPSTREAM, /* PPStream - Chinese P2PTV */ LPI_PROTO_UDP_FORTINET, /* Fortinet update protocol */ LPI_PROTO_UDP_TVANTS, /* TVants P2PTV - no longer active */ LPI_PROTO_UDP_STORM_WORM, LPI_PROTO_UDP_BATTLEFIELD, /* Battlefield series of games */ LPI_PROTO_UDP_SOPCAST, LPI_PROTO_UDP_SERIALNUMBERD, LPI_PROTO_UDP_LDAP_AD, LPI_PROTO_UDP_RTMFP, LPI_PROTO_UDP_L2TP, LPI_PROTO_UDP_SYSLOG, LPI_PROTO_UDP_AKAMAI, LPI_PROTO_UDP_RADIUS, LPI_PROTO_UDP_HAMACHI, LPI_PROTO_UDP_BJNP, /* Canon BJNP printing protocol */ LPI_PROTO_UDP_KASPERSKY, LPI_PROTO_UDP_GSM, LPI_PROTO_UDP_JEDI, /* Citrix Jedi */ LPI_PROTO_UDP_YOUKU, LPI_PROTO_UDP_YOUDAO_DICT, LPI_PROTO_UDP_DRIVESHARE, LPI_PROTO_UDP_CIRN, /* Carpathia Intelligent Routing Network */ LPI_PROTO_UDP_NEVERWINTER, LPI_PROTO_UDP_QQLIVE, LPI_PROTO_UDP_TEAMVIEWER, LPI_PROTO_UDP_ARES, LPI_PROTO_UDP_EPSON, LPI_PROTO_UDP_AKAMAI_TRANSFER, LPI_PROTO_UDP_DCC, LPI_PROTO_UDP_AMANDA, LPI_PROTO_UDP_NETFLOW, LPI_PROTO_UDP_ZEROACCESS, LPI_PROTO_UDP_VXWORKS_EXPLOIT, LPI_PROTO_UDP_APPLE_FACETIME_INIT, LPI_PROTO_UDP_STEAM_LOCALBROADCAST, /* ^Protocol used by Steam to discover clients on the local network */ LPI_PROTO_UDP_LANSYNC, /* LANSync, used by DropBox */ LPI_PROTO_UDP_BTSYNC, LPI_PROTO_UDP_MSOFFICE_MAC, /* MS Office for Mac anti-piracy */ LPI_PROTO_UDP_SPOTIFY_BROADCAST, LPI_PROTO_UDP_MDNS, /* Multicast DNS */ LPI_PROTO_UDP_FASP, LPI_PROTO_UDP_RAKNET, LPI_PROTO_UDP_OPENVPN, LPI_PROTO_UDP_NOE, /* Alcatel's New Office Environment */ LPI_PROTO_UDP_VIBER, LPI_PROTO_UDP_DTLS, LPI_PROTO_UDP_ICP, LPI_PROTO_UDP_LOL, /* League of Legends */ LPI_PROTO_UDP_SANANDREAS, /* San Andreas Multiplayer */ LPI_PROTO_UDP_MFNP, /* Canon MFNP Printer protocol */ LPI_PROTO_UDP_FUNSHION, LPI_PROTO_UDP_QUIC, LPI_PROTO_UDP_AVAST_DNS, LPI_PROTO_UDP_DB2, LPI_PROTO_UDP_NATPMP, LPI_PROTO_UDP_GPRS_TUNNEL, LPI_PROTO_UDP_WECHAT, LPI_PROTO_UDP_NOCTION, LPI_PROTO_UDP_ARMA_SERVER, /* Includes DayZ */ LPI_PROTO_UDP_PLANETSIDE2, LPI_PROTO_UDP_RWTH_AACHEN, /* RWTH-Aachen University research */ LPI_PROTO_UDP_BMDP, /* Part of Microsoft ADS */ LPI_PROTO_UDP_DOTA2, LPI_PROTO_UDP_LINE, LPI_PROTO_UDP_ZOOM, LPI_PROTO_UDP_HEROES_GENERALS, /* Heroes and Generals */ LPI_PROTO_UDP_WARTHUNDER, LPI_PROTO_UDP_H1Z1, LPI_PROTO_UDP_CS_GLOBAL_OFFENSIVE, LPI_PROTO_UDP_NTP_REFLECT, /* NTP reflection attack */ LPI_PROTO_UDP_PUNKBUSTER, LPI_PROTO_UDP_ROBOCRAFT, LPI_PROTO_UDP_CISCO_SSLVPN, LPI_PROTO_UDP_ACERCLOUD, LPI_PROTO_UDP_360CN, LPI_PROTO_UDP_WOLF_ET, LPI_PROTO_UDP_KUGOU, LPI_PROTO_UDP_XUNLEI_JSQ, LPI_PROTO_UDP_KANKAN, LPI_PROTO_UDP_QQPCMGR, LPI_PROTO_UDP_DIANPING, LPI_PROTO_UDP_XUNYOU, LPI_PROTO_UDP_FORTICLIENT_SSLVPN, LPI_PROTO_UDP_DISCORD, LPI_PROTO_UDP_NETCORE, LPI_PROTO_UDP_ARMA3_SERVER, LPI_PROTO_UDP_BAIDU_YUN_P2P, LPI_PROTO_UDP_YY, LPI_PROTO_UDP_OVERWATCH, LPI_PROTO_UDP_BACNET, LPI_PROTO_UDP_ARK_SURVIVAL, LPI_PROTO_UDP_360P2P, LPI_PROTO_UDP_PORTMAP_RPC, LPI_PROTO_UDP_NINTENDO, LPI_PROTO_UDP_CHIVALRY, LPI_PROTO_UDP_DOYO, LPI_PROTO_UDP_NETCAT_CCTV, LPI_PROTO_UDP_N2PING, LPI_PROTO_UDP_RAMSEY_DASH, LPI_PROTO_UDP_UBISOFT_GAMES, LPI_PROTO_UDP_THE_CREW, LPI_PROTO_UDP_TURBOVPN, LPI_PROTO_UDP_GEARSOFWAR, LPI_PROTO_UDP_RDP, LPI_PROTO_UDP_HOTS, LPI_PROTO_UDP_VPNMASTER, LPI_PROTO_UDP_DIANSHIJIA, LPI_PROTO_UDP_PS4_REMOTEPLAY, LPI_PROTO_UDP_STARCITIZEN, LPI_PROTO_UDP_WEBEX, LPI_PROTO_UDP_HALO_ONLINE, LPI_PROTO_UDP_GOTOMEETING, LPI_PROTO_UDP_CROSSOUT, LPI_PROTO_UDP_UMEYE, LPI_PROTO_UDP_RISING_STORM, LPI_PROTO_UDP_CROSSFIRE, LPI_PROTO_UDP_MERAKICLOUD, LPI_PROTO_UDP_SNAPVPN, LPI_PROTO_UDP_DAHUA, LPI_PROTO_UDP_STARLEAF, LPI_PROTO_UDP_FOSCAM, LPI_PROTO_UDP_DESTINY, LPI_PROTO_UDP_BAOFENG, LPI_PROTO_UDP_TORCHLIGHT2, LPI_PROTO_UDP_SMITE, LPI_PROTO_UDP_COUNTERSTRIKE_16, LPI_PROTO_UDP_VPNROBOT, LPI_PROTO_UDP_TF2, LPI_PROTO_UDP_GANGSOFSPACE, LPI_PROTO_UDP_COMBATARMS, LPI_PROTO_UDP_COMBATARMS_P2P, LPI_PROTO_UDP_PANIPANI, LPI_PROTO_UDP_FEITWO, LPI_PROTO_UDP_MOONHUNTERS, LPI_PROTO_UDP_HELIBORNE, LPI_PROTO_UDP_KINGOFGLORY, LPI_PROTO_UDP_ASSETTO_CORSA, LPI_PROTO_UDP_CACAOWEB, LPI_PROTO_UDP_ZALO_CALL, LPI_PROTO_UDP_PALADINS, LPI_PROTO_UDP_CHARGEN_EXPLOIT, LPI_PROTO_UDP_TOX, LPI_PROTO_UDP_HOLLA, LPI_PROTO_UDP_RRSHARE, LPI_PROTO_UDP_QQSPEEDMOBILE, LPI_PROTO_UDP_LOADOUT, LPI_PROTO_UDP_GANGLIA, LPI_PROTO_UDP_TALESRUNNER, LPI_PROTO_UDP_FREEFIRE, LPI_PROTO_UDP_HEROES_EVOLVED, LPI_PROTO_UDP_RULES_OF_SURVIVAL, LPI_PROTO_UDP_CONTRACT_WARS, LPI_PROTO_UDP_ARD, LPI_PROTO_UDP_QVOD, LPI_PROTO_UDP_YUANFUDAO, LPI_PROTO_UDP_ROCKET_LEAGUE, LPI_PROTO_UDP_CLOUDFLARE_WARP, LPI_PROTO_UDP_WIREGUARD, LPI_PROTO_UDP_COD_MOBILE, LPI_PROTO_UDP_NVIDIA_GAMESTREAM, LPI_PROTO_UDP_CLASSIN, LPI_PROTO_UDP_ARTCP, /* Patterns that we can match, but do not know the protocol */ LPI_PROTO_REJECTION, /* All responses are 0x02 */ LPI_PROTO_MYSTERY_9000, /* Occurs on tcp port 9000 */ LPI_PROTO_MYSTERY_PSPR, LPI_PROTO_MYSTERY_8000, LPI_PROTO_MYSTERY_IG, LPI_PROTO_MYSTERY_CONN, LPI_PROTO_MYSTERY_SYMANTEC, LPI_PROTO_MYSTERY_RXXF, LPI_PROTO_UDP_MYSTERY_0D, LPI_PROTO_UDP_MYSTERY_99, LPI_PROTO_UDP_MYSTERY_8000, LPI_PROTO_UDP_MYSTERY_45, LPI_PROTO_UDP_MYSTERY_0660, LPI_PROTO_UDP_MYSTERY_E9, LPI_PROTO_UDP_MYSTERY_QQ, LPI_PROTO_UDP_MYSTERY_61_72, LPI_PROTO_UDP_MYSTERY_05, LPI_PROTO_ICMP, LPI_PROTO_INVALID, /* No single valid protocol */ LPI_PROTO_NO_PAYLOAD, LPI_PROTO_NO_FIRSTPKT, LPI_PROTO_UNSUPPORTED, LPI_PROTO_UNKNOWN, LPI_PROTO_LAST /** ALWAYS have this as the last value */ } lpi_protocol_t; /* This structure stores all the data needed by libprotoident to identify the * application protocol for a flow. Do not change the contents of this struct * directly - lpi_update_data() will do that for you - but reading the values * should be ok. */ typedef struct lpi { uint32_t payload[2]; bool seen_syn[2]; uint32_t seqno[2]; uint32_t observed[2]; uint16_t server_port; uint16_t client_port; uint8_t trans_proto; uint32_t payload_len[2]; uint32_t ips[2]; } lpi_data_t; typedef struct lpi_module lpi_module_t; /* This structure describes an individual LPI module - i.e. a protocol * supported by libprotoident */ struct lpi_module { lpi_protocol_t protocol; /* The protocol ID */ lpi_category_t category; /* The category for this protocol */ const char *name; /* The protocol name, as a string */ uint8_t priority; /* The relative priority for matching this protocol */ /* The callback function for testing whether a given set of LPI * data matches the ruleset for this protocol */ bool (*lpi_callback) (lpi_data_t *proto_d, lpi_module_t *module); }; typedef std::list ProtoMatchList; typedef struct lpi_thread { int index; lpi_module_t *module; lpi_data_t *data; bool result; } lpi_thread_t; typedef std::list ThreadList; /* Initialises the LPI library, by registering all the protocol modules. * * @return 0 if initialisation succeeded, -1 otherwise */ int lpi_init_library(void); /* Shuts down the LPI library, by de-registering all the protocol modules */ void lpi_free_library(void); /** Initialises an LPI data structure, setting all the members to appropriate * starting values. * * @param data The LPI data structure to be initialised. */ void lpi_init_data(lpi_data_t *data); /** Updates the LPI data structure based on the contents of the packet * provided. * * @note The direction must be provided by the caller, as we cannot rely * on trace_get_direction(). * * @param packet The packet to update the LPI data from. * @param data The LPI data structure to be updated. * @param dir The direction of the packet - 0 is outgoing, 1 is incoming. * * @return 0 if the packet was ignored, 1 if the LPI data was updated. */ int lpi_update_data(libtrace_packet_t *packet, lpi_data_t *data, uint8_t dir); /** Returns a unique string describing the provided protocol. * * This is essentially a protocol-to-string conversion function. * * @param proto The protocol that a string representation is required for. * * @return A pointer to a statically allocated string describing the protocol. * This is allocated on the stack, so should be used or copied immediately. */ const char *lpi_print(lpi_protocol_t proto); /** Given a protocol, returns the category that it matches. * * @param proto The protocol that a category is required for. * * @return The category that the protocol belongs to. */ lpi_category_t lpi_categorise(lpi_module_t *proto); /** Returns a unique string describing the provided category. * * This is essentially a category-to-string conversion function. * * @param category The category that a string representation is required for. * * @return A pointer to a statically allocated string describing the category. * This is allocated on the stack, so should be used or copied immediately. */ const char *lpi_print_category(lpi_category_t category); /** Using the provided data, attempts to determine the L7 protocol being used * by that flow. * * @param data The LPI data to use when determining the protocol. * * @return The LPI module for the protocol that matches the profile described * by the given LPI data. If no protocol matches, the module for either * LPI_UNKNOWN or LPI_UNKNOWN_UDP will be returned, depending on the transport * protocol. */ lpi_module_t *lpi_guess_protocol(lpi_data_t *data); /** Given the protocol name, returns the lpi protcol it matches. * * @param name The protocol name * * @returns The LPI protocol for the supplied name. * LPI_PROTO_UNKNOWN if the name is not found. */ lpi_protocol_t lpi_get_protocol_by_name(char *name); /* Give the category name, returns the lpi category it matches. * * @param name The protocol name * * @returns the LPI category for the supplied name on success. * LPI_CATEGORY_UNKNOWN if the name is not found. */ lpi_category_t lpi_get_category_by_name(char *name); /* Given the lpi protocol, returns the lpi category it matches. * * @param protocol The lpi protocol * * @returns the lpi category for the supplied lpi protocol. * LPI_CATEGORY_UNKNOWN if the category is not found. */ lpi_category_t lpi_get_category_by_protocol(lpi_protocol_t protocol); /** Determines whether the protocol matching a given protocol number is no * longer supported by libprotoident. * * @param proto The protocol to check * * @return true if the protocol is no longer supported, false otherwise. * * Some protocols are no longer supported by libprotoident, either because * the rules were found to be producing too many false positives or the * protocol has been merged with another existing protocol (especially in the * case of mystery protocols). When these cases occur, we don't necessarily * remove the protocol from the enumerated type list, just disable the module * and set the name string for the protocol to "NULL". * * This function allows the caller to check if a given protocol value has * been disabled. This is often handy when reporting stats for all the * protocol values (see lpi_live for an example), as ideally you would want * to avoid reporting anything for the NULL protocols. */ bool lpi_is_protocol_inactive(lpi_protocol_t proto); #ifdef __cplusplus } #endif #endif ================================================ FILE: lib/proto_common.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #ifdef __APPLE__ #include #define bswap32 OSSwapInt32 #endif #ifdef __FreeBSD__ #include #endif #ifdef __linux__ #include #define bswap32 __bswap_32 #endif #include "libprotoident.h" #include "proto_common.h" bool match_str_either(lpi_data_t *data, const char *string) { if (MATCHSTR(data->payload[0], string)) return true; if (MATCHSTR(data->payload[1], string)) return true; return false; } bool match_str_both(lpi_data_t *data, const char *string1, const char *string2) { if (MATCHSTR(data->payload[0], string1) && MATCHSTR(data->payload[1], string2)) return true; if (MATCHSTR(data->payload[1], string1) && MATCHSTR(data->payload[0], string2)) return true; return false; } bool match_chars_either(lpi_data_t *data, char a, char b, char c, char d) { if (MATCH(data->payload[0], a, b, c, d)) return true; if (MATCH(data->payload[1], a, b, c, d)) return true; return false; } bool match_payload_length(uint32_t payload, uint32_t payload_len) { uint32_t header = 0; header = ntohl(payload); /* See if the length in the (presumed) header matches the * length of the rest of the packet minus the header itself (4 bytes). * * Watch out for the case of a 4 byte packet containing just * 00 00 00 00! */ if (payload_len > 4 && header == payload_len - 4) return true; return false; } bool match_ip_address_both(lpi_data_t *data) { uint8_t matches = 0; if (data->ips[0] == 0 || data->ips[0] == 0) return false; if (data->payload_len[0] == 0) matches += 1; else if (data->payload[0] == data->ips[0]) matches += 1; else if (data->payload[0] == data->ips[1]) matches += 1; if (data->payload_len[1] == 0) matches += 1; else if (data->payload[1] == data->ips[0]) matches += 1; else if (data->payload[1] == data->ips[1]) matches += 1; if (matches == 2) return true; else return false; } /* Multiple protocols use HTTP-style requests */ bool match_http_request(uint32_t payload, uint32_t len) { /* HTTP requests - some of these are MS-specific extensions */ if (len == 0) return true; if (MATCHSTR(payload, "GET ")) return true; if (len == 1 && MATCH(payload, 'G', 0x00, 0x00, 0x00)) return true; if (len == 2 && MATCH(payload, 'G', 'E', 0x00, 0x00)) return true; if (len == 3 && MATCH(payload, 'G', 'E', 'T', 0x00)) return true; if (MATCHSTR(payload, "POST")) return true; if (MATCHSTR(payload, "HEAD")) return true; if (MATCHSTR(payload, "PUT ")) return true; if (MATCHSTR(payload, "DELE")) return true; if (MATCHSTR(payload, "auth")) return true; /* SVN? */ if (MATCHSTR(payload, "REPO")) return true; /* Webdav */ if (MATCHSTR(payload, "LOCK")) return true; if (MATCHSTR(payload, "UNLO")) return true; if (MATCHSTR(payload, "OPTI")) return true; if (MATCHSTR(payload, "PROP")) return true; if (MATCHSTR(payload, "MKCO")) return true; if (MATCHSTR(payload, "POLL")) return true; if (MATCHSTR(payload, "SEAR")) return true; /* Ntrip - some differential GPS system using modified HTTP */ if (MATCHSTR(payload, "SOUR")) return true; return false; } /* File headers are not specific to any particular protocol */ bool match_file_header(uint32_t payload) { /* RIFF is a meta-format for storing AVI and WAV files */ if (MATCHSTR(payload, "RIFF")) return true; /* MZ is a .exe file */ if (MATCH(payload, 'M', 'Z', ANY, 0x00)) return true; /* Ogg files */ if (MATCHSTR(payload, "OggS")) return true; /* ZIP files */ if (MATCH(payload, 'P', 'K', 0x03, 0x04)) return true; /* MPEG files */ if (MATCH(payload, 0x00, 0x00, 0x01, 0xba)) return true; /* RAR files */ if (MATCHSTR(payload, "Rar!")) return true; /* EBML */ if (MATCH(payload, 0x1a, 0x45, 0xdf, 0xa3)) return true; /* JPG */ if (MATCH(payload, 0xff, 0xd8, ANY, ANY)) return true; /* GIF */ if (MATCHSTR(payload, "GIF8")) return true; /* I'm also going to include PHP scripts in here */ if (MATCH(payload, 0x3c, 0x3f, 0x70, 0x68)) return true; /* Unix scripts */ if (MATCH(payload, 0x23, 0x21, 0x2f, 0x62)) return true; /* PDFs */ if (MATCHSTR(payload, "%PDF")) return true; /* PNG */ if (MATCH(payload, 0x89, 'P', 'N', 'G')) return true; /* HTML */ if (MATCHSTR(payload, "server_port == 80 || data->client_port == 80) return true; if (data->server_port == 8080 || data->client_port == 8080) return true; if (data->server_port == 8081 || data->client_port == 8081) return true; /* If port 443 responds, we want it to be counted as genuine * HTTP, rather than a bad port scenario */ if (data->server_port == 443 || data->client_port == 443) { if (data->payload_len[0] > 0 && data->payload_len[1] > 0) return true; } return false; } /* 16 03 00 X is an SSLv3 handshake */ static inline bool match_ssl3_handshake(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len == 1 && MATCH(payload, 0x16, 0x00, 0x00, 0x00)) return true; if (MATCH(payload, 0x16, 0x03, 0x00, ANY)) return true; return false; } /* 16 03 01 X is an TLS handshake */ static inline bool match_tls_handshake(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len == 1 && MATCH(payload, 0x16, 0x00, 0x00, 0x00)) return true; if (MATCH(payload, 0x16, 0x03, 0x01, ANY)) return true; if (MATCH(payload, 0x16, 0x03, 0x02, ANY)) return true; if (MATCH(payload, 0x16, 0x03, 0x03, ANY)) return true; return false; } /* SSLv2 handshake - the ANY byte in the 0x80 payload is actually the length * of the payload - 2. * * XXX This isn't always true - consecutive packets may be merged it seems :( */ static inline bool match_ssl2_handshake(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x80, ANY, 0x01, 0x03)) return true; if (MATCH(payload, 0x81, ANY, 0x01, 0x03)) return true; return false; } static inline bool match_tls_alert(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x15, 0x03, 0x01, ANY)) return true; if (MATCH(payload, 0x15, 0x03, 0x02, ANY)) return true; if (MATCH(payload, 0x15, 0x03, 0x03, ANY)) return true; /* Alerts are also possible under SSL 3.0 */ if (MATCH(payload, 0x15, 0x03, 0x00, ANY)) return true; return false; } static inline bool match_tls_change(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x14, 0x03, 0x01, ANY)) return true; if (MATCH(payload, 0x14, 0x03, 0x02, ANY)) return true; if (MATCH(payload, 0x14, 0x03, 0x03, ANY)) return true; return false; } static inline bool match_tls_content(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x17, 0x03, 0x01, ANY)) return true; if (MATCH(payload, 0x17, 0x03, 0x02, ANY)) return true; if (MATCH(payload, 0x17, 0x03, 0x03, ANY)) return true; return false; } bool match_ssl(lpi_data_t *data) { if (match_ssl3_handshake(data->payload[0], data->payload_len[0]) && match_ssl3_handshake(data->payload[1], data->payload_len[1])) return true; if (match_tls_handshake(data->payload[0], data->payload_len[0]) && match_tls_handshake(data->payload[1], data->payload_len[1])) return true; if (match_ssl3_handshake(data->payload[0], data->payload_len[0]) && match_tls_handshake(data->payload[1], data->payload_len[1])) return true; if (match_tls_handshake(data->payload[0], data->payload_len[0]) && match_ssl3_handshake(data->payload[1], data->payload_len[1])) return true; /* Seems we can sometimes skip the full handshake and start on the data * right away (as indicated by 0x17) - for now, I've only done this for TLS */ if (match_tls_handshake(data->payload[0], data->payload_len[0]) && match_tls_content(data->payload[1], data->payload_len[1])) return true; if (match_tls_handshake(data->payload[1], data->payload_len[1]) && match_tls_content(data->payload[0], data->payload_len[0])) return true; /* Need to check for TLS alerts (errors) too */ if (match_tls_handshake(data->payload[0], data->payload_len[0]) && match_tls_alert(data->payload[1], data->payload_len[1])) return true; if (match_tls_handshake(data->payload[1], data->payload_len[1]) && match_tls_alert(data->payload[0], data->payload_len[0])) return true; if (match_ssl3_handshake(data->payload[0], data->payload_len[0]) && match_tls_alert(data->payload[1], data->payload_len[1])) return true; if (match_ssl3_handshake(data->payload[1], data->payload_len[1]) && match_tls_alert(data->payload[0], data->payload_len[0])) return true; /* Need to check for cipher changes too */ if (match_tls_handshake(data->payload[0], data->payload_len[0]) && match_tls_change(data->payload[1], data->payload_len[1])) return true; if (match_tls_handshake(data->payload[1], data->payload_len[1]) && match_tls_change(data->payload[0], data->payload_len[0])) return true; /* Some HTTPS servers respond with unencrypted content, presumably * when somebody invalid attempts a connection */ if (match_tls_handshake(data->payload[0], data->payload_len[0]) && MATCHSTR(data->payload[1], "payload_len[0] != 0) return true; if (match_tls_handshake(data->payload[1], data->payload_len[1]) && MATCHSTR(data->payload[0], "payload_len[1] != 0) return true; /* Allow TLS content in both directions -- could be multi-path TCP? * Or some form of picking up where a previous connection left off? */ if (match_tls_content(data->payload[0], data->payload_len[0]) && match_tls_content(data->payload[1], data->payload_len[1])) return true; if (match_tls_content(data->payload[1], data->payload_len[1]) && match_tls_content(data->payload[0], data->payload_len[0])) return true; if ((match_tls_handshake(data->payload[0], data->payload_len[0]) || match_ssl3_handshake(data->payload[0], data->payload_len[0])) && match_ssl2_handshake(data->payload[1], data->payload_len[1])) return true; if ((match_tls_handshake(data->payload[1], data->payload_len[1]) || match_ssl3_handshake(data->payload[1], data->payload_len[1])) && match_ssl2_handshake(data->payload[0], data->payload_len[0])) return true; if (data->payload_len[0] == 0 && match_ssl2_handshake(data->payload[1], data->payload_len[1])) return true; if (data->payload_len[1] == 0 && match_ssl2_handshake(data->payload[0], data->payload_len[0])) return true; return false; } static bool dns_req(uint32_t payload) { /* The flags / rcode on requests are usually all zero. * * Exceptions: CD and RD may be set * * Remember BYTE ORDER! */ payload = htonl(payload); if ((payload & 0x0000ffff) == 0x00000000) return true; /* Check for CD */ if ((payload & 0x0000ffff) == 0x00000010) return true; /* Check for RD */ if ((payload & 0x0000ffff) == 0x00000100) return true; return false; } static bool dns_backscatter(uint32_t payload) { /* Let's see if we can identify unsolicited DNS responses */ /* Last byte seems to be always 0x00 - third is either 0x84 or 0x85 */ payload = htonl(payload); if ((payload & 0x0000ffff) == 0x00008500) return true; if ((payload & 0x0000ffff) == 0x00008580) return true; if ((payload & 0x0000ffff) == 0x00008400) return true; if ((payload & 0x0000ffff) == 0x00008480) return true; if ((payload & 0x0000ffff) == 0x00008483) return true; if ((payload & 0x0000ffff) == 0x00008403) return true; if ((payload & 0x0000ffff) == 0x00008000) return true; return false; } bool match_dns(lpi_data_t *data) { if (data->payload_len[0] == 0 || data->payload_len[1] == 0) { /* No response, so we have a bit of a hard time - however, * most requests have a pretty standard set of flags. * * We'll also use the port here to help out */ if (data->server_port != 53 && data->client_port != 53) return false; if (data->payload_len[0] > 12 && dns_req(data->payload[0])) return true; if (data->payload_len[1] > 12 && dns_req(data->payload[1])) return true; if (data->payload_len[0] > 12 && dns_backscatter(data->payload[0])) return true; if (data->payload_len[1] > 12 && dns_backscatter(data->payload[1])) return true; return false; } if (((htonl(data->payload[0])) & 0xffff7800) != ((htonl(data->payload[1])) & 0xffff7800)) return false; if ((htonl(data->payload[0]) & 0x00008000) == (htonl(data->payload[1]) & 0x00008000)) return false; return true; } bool match_tds_request(uint32_t payload, uint32_t len) { uint32_t stated_len = 0; stated_len = (ntohl(payload) & 0xffff); if (stated_len != len) return false; if (MATCH(payload, 0x12, 0x01, ANY, ANY)) return true; if (MATCH(payload, 0x10, 0x01, ANY, ANY)) return true; return false; } bool match_8000_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 0x3b, 0x00, 0x00, 0x00)) { return true; } if (MATCH(payload, 0x3c, 0x00, 0x00, 0x00)) { return true; } if (MATCH(payload, 0x3d, 0x00, 0x00, 0x00)) { return true; } if (MATCH(payload, 0x3e, 0x00, 0x00, 0x00)) { return true; } return false; } bool match_emule(lpi_data_t *data) { /* Check that payload begins with e3 or c5 in both directions before * classifying as eMule */ /* (I noticed that most emule(probably) flows began with "e3 xx 00 00" * or "c5 xx 00 00", perhaps is worth looking into... Although I * couldn't find anything about emule packets) */ if (data->payload_len[0] < 4 && data->payload_len[1] < 4) return false; if (MATCH(data->payload[0], 0xe3, ANY, 0x00, 0x00) && MATCH(data->payload[1], 0xe3, ANY, 0x00, 0x00)) return true; if (MATCH(data->payload[0], 0xe3, ANY, 0x00, 0x00) && MATCH(data->payload[1], 0xc5, ANY, 0x00, 0x00)) return true; /* XXX I haven't seen any obviously legit emule that starts with c5 * in both directions */ /* if (MATCH(data->payload[0], 0xc5, ANY, ANY, ANY) && MATCH(data->payload[1], 0xc5, ANY, ANY, ANY)) return true; */ if (MATCH(data->payload[0], 0xc5, ANY, 0x00, 0x00) && MATCH(data->payload[1], 0xe3, ANY, 0x00, 0x00)) return true; if (MATCH(data->payload[0], 0xe3, ANY, 0x00, 0x00) && data->payload_len[1] == 0) return true; if (MATCH(data->payload[1], 0xe3, ANY, 0x00, 0x00) && data->payload_len[0] == 0) return true; return false; } static inline bool match_kaspersky_ke(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 'K', 'E', 0x00, 0x00)) return true; if (MATCH(payload, 'K', 'E', 0x00, 0x02)) return true; if (MATCH(payload, 'K', 'E', 0x00, 0x07)) return true; return false; } static inline bool match_kaspersky_ks(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 'K', 'S', 0x00, 0x00)) return true; return false; } bool match_kaspersky(lpi_data_t *data) { /* Traffic is either on TCP port 443 or UDP port 2001. * * One of the endpoints is always in either a Kaspersky range or * an old PSInet range */ if (match_str_both(data, "PI\x00\x00", "PI\x00\x00")) { if (data->payload_len[0] == 2 && data->payload_len[1] == 2) return true; } if (match_kaspersky_ke(data->payload[0], data->payload_len[0])) { if (match_kaspersky_ke(data->payload[1], data->payload_len[1])) return true; } if (match_kaspersky_ks(data->payload[0], data->payload_len[0])) { if (match_kaspersky_ks(data->payload[1], data->payload_len[1])) return true; } return false; } bool match_youku_payload(uint32_t pload, uint32_t len) { if (len == 0) return true; if (MATCH(pload, 0x4b, 0x55, 0x00, 0x01)) return true; if (MATCH(pload, 0x4b, 0x55, 0x00, 0x02)) return true; if (MATCH(pload, 0x4b, 0x55, 0x00, 0x03)) return true; if (MATCH(pload, 0x4b, 0x55, 0x00, 0x04)) return true; return false; } bool match_tpkt(uint32_t payload, uint32_t len) { uint32_t stated_len = 0; /* * TPKT header is 03 00 + 2 bytes of length (including the TPKT header) */ if (!MATCH(payload, 0x03, 0x00, ANY, ANY)) return false; stated_len = ntohl(payload) & 0xffff; if (stated_len != len) return false; return true; } bool match_qqlive_payload(uint32_t payload, uint32_t len) { uint32_t swap; /* This appears to have a 3 byte header. First byte is always 0xfe. * Second and third bytes are the length (minus the 3 byte header). */ if (len == 0) return true; swap = htonl(payload); swap = (swap & 0xffff00) >> 8; if (ntohs(swap) != len - 3) return false; /* Interestingly, the third and fourth byte always match */ swap = htonl(payload); if ((swap & 0xff) != ((swap & 0xff00) >> 8)) return false; if (MATCH(payload, 0xfe, ANY, ANY, ANY)) return true; return false; } bool match_yy_payload(uint32_t payload, uint32_t len) { /* The first four bytes are a length field, but using the * wrong byte order... */ if (!MATCH(payload, ANY, ANY, 0x00, 0x00)) return false; #if BYTE_ORDER == BIG_ENDIAN if (bswap32(payload) == len) return true; #else if (payload == len) return true; #endif return false; } /* Byte swapping functions for various inttypes */ uint64_t byteswap64(uint64_t num) { return (byteswap32((num&0xFFFFFFFF00000000ULL)>>32)) |((uint64_t)byteswap32(num&0x00000000FFFFFFFFULL)<<32); } uint32_t byteswap32(uint32_t num) { return ((num&0x000000FFU)<<24) | ((num&0x0000FF00U)<<8) | ((num&0x00FF0000U)>>8) | ((num&0xFF000000U)>>24); } uint16_t byteswap16(uint16_t num) { return ((num<<8)&0xFF00)|((num>>8)&0x00FF); } ================================================ FILE: lib/proto_common.h ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #ifndef PROTO_COMMON_H_ #define PROTO_COMMON_H_ #include "libprotoident.h" #ifndef __BYTE_ORDER #include #endif #define ANY -1 #define MASKOCTET(x) \ ((x) == ANY ? 0U : 255U) #if __BYTE_ORDER == __BIG_ENDIAN #define FORMUP(a,b,c,d) \ (unsigned)((((a)&0xFF)<<24)|(((b)&0xFF)<<16)|(((c)&0xFF)<<8)|((d)&0xFF)) #else #define FORMUP(a,b,c,d) \ (unsigned)((((d)&0xFF)<<24)|(((c)&0xFF)<<16)|(((b)&0xFF)<<8)|((a)&0xFF)) #endif #define FORMUPMASK(a,b,c,d) \ FORMUP(MASKOCTET(a),MASKOCTET(b),MASKOCTET(c),MASKOCTET(d)) #define MATCH(x,a,b,c,d) \ ((x&FORMUPMASK(a,b,c,d))==(FORMUP(a,b,c,d)&FORMUPMASK(a,b,c,d))) #define MATCHSTR(x,st) \ (memcmp(&(x),(st),sizeof(x))==0) /** Byteswaps a 64-bit value. * * @param num The value to be byteswapped. * @return The byteswapped 64-bit number * */ uint64_t byteswap64(uint64_t num); /** Byteswaps a 32-bit value. * * @param num The value to be byteswapped. * @return The byteswapped 32-bit number * */ uint32_t byteswap32(uint32_t num); /** Byteswaps a 16-bit value. * * @param num The value to be byteswapped. * @return The byteswapped 16-bit number * */ uint16_t byteswap16(uint16_t num); #if __BYTE_ORDER == __BIG_ENDIAN #define bswap_host_to_be64(num) ((uint64_t)(num)) #define bswap_host_to_le64(num) byteswap64(num) #define bswap_host_to_be32(num) ((uint32_t)(num)) #define bswap_host_to_le32(num) byteswap32(num) #define bswap_host_to_be16(num) ((uint16_t)(num)) #define bswap_host_to_le16(num) byteswap16(num) #define bswap_be_to_host64(num) ((uint64_t)(num)) #define bswap_le_to_host64(num) byteswap64(num) #define bswap_be_to_host32(num) ((uint32_t)(num)) #define bswap_le_to_host32(num) byteswap32(num) #define bswap_be_to_host16(num) ((uint16_t)(num)) #define bswap_le_to_host16(num) byteswap16(num) /* We use ntoh*() here, because the compiler may * attempt to optimise it */ #elif __BYTE_ORDER == __LITTLE_ENDIAN #define bswap_host_to_be64(num) (byteswap64(num)) #define bswap_host_to_le64(num) ((uint64_t)(num)) #define bswap_host_to_be32(num) (htonl(num)) #define bswap_host_to_le32(num) ((uint32_t)(num)) #define bswap_host_to_be16(num) (htons(num)) #define bswap_host_to_le16(num) ((uint16_t)(num)) #define bswap_be_to_host64(num) (byteswap64(num)) #define bswap_le_to_host64(num) ((uint64_t)(num)) #define bswap_be_to_host32(num) (ntohl(num)) #define bswap_le_to_host32(num) ((uint32_t)(num)) #define bswap_be_to_host16(num) (ntohs(num)) #define bswap_le_to_host16(num) ((uint16_t)(num)) #else #error "Unknown byte order" #endif bool match_str_either(lpi_data_t *data, const char *string); bool match_str_both(lpi_data_t *data, const char *string1, const char *string2); bool match_chars_either(lpi_data_t *data, char a, char b, char c, char d); bool match_payload_length(uint32_t payload, uint32_t payload_len); bool match_ip_address_both(lpi_data_t *data); bool match_file_header(uint32_t payload); bool match_http_request(uint32_t payload, uint32_t len); bool valid_http_port(lpi_data_t *data); bool match_ssl(lpi_data_t *data); bool match_dns(lpi_data_t *data); bool match_tds_request(uint32_t payload, uint32_t len); bool match_8000_payload(uint32_t payload, uint32_t len); bool match_youku_payload(uint32_t payload, uint32_t len); bool match_emule(lpi_data_t *data); bool match_kaspersky(lpi_data_t *data); bool match_tpkt(uint32_t payload, uint32_t len); bool match_qqlive_payload(uint32_t payload, uint32_t len); bool match_yy_payload(uint32_t payload, uint32_t len); #endif ================================================ FILE: lib/proto_manager.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include "config.h" #include #include #include "proto_manager.h" #include "tcp/tcp_protocols.h" #include "udp/udp_protocols.h" void register_protocol(lpi_module_t *mod, LPIModuleMap *mod_map) { LPIModuleMap::iterator it; LPIModuleList *ml; it = mod_map->find(mod->priority); if (it == mod_map->end()) { (*mod_map)[mod->priority] = new LPIModuleList(); it = mod_map->find(mod->priority); } ml = it->second; ml->push_back(mod); } void free_protocols(LPIModuleMap *mod_map) { LPIModuleMap::iterator it; LPIModuleList *ml; for (it = mod_map->begin(); it != mod_map->end(); it ++) { ml = it->second; ml->clear(); delete(ml); } mod_map->clear(); } int register_tcp_protocols(LPIModuleMap *mod_map) { register_300heroes(mod_map); register_360safeguard(mod_map); register_4d(mod_map); register_acestream(mod_map); register_afp(mod_map); register_airdroid(mod_map); register_airmedia(mod_map); register_akamai_tcp(mod_map); register_amp(mod_map); register_antcoin(mod_map); register_appearin(mod_map); register_apple_push(mod_map); register_ares(mod_map); register_badbaidu(mod_map); register_baofeng_tcp(mod_map); register_beam(mod_map); register_bitcoin(mod_map); register_bitextend(mod_map); register_bittorrent(mod_map); register_blackdesert(mod_map); register_blizzard(mod_map); register_btsync(mod_map); register_bwsyncandshare(mod_map); register_cacaoweb(mod_map); register_cgp(mod_map); register_chatango(mod_map); register_cisco_vpn(mod_map); register_clashofclans(mod_map); register_classin_tcp(mod_map); register_clubbox(mod_map); register_cod_waw(mod_map); register_conquer(mod_map); register_crashplan(mod_map); register_crossfire_tcp(mod_map); register_cryptic(mod_map); register_cvs(mod_map); register_dahua_tcp(mod_map); register_dash(mod_map); register_dell_backup(mod_map); register_destiny(mod_map); register_diablo3(mod_map); register_dianping_tcp(mod_map); register_directconnect(mod_map); register_dnf(mod_map); register_dns_tcp(mod_map); register_dogecoin(mod_map); register_douyu(mod_map); register_douyu_chat(mod_map); register_duelingnetwork(mod_map); register_dvrns(mod_map); register_dxp(mod_map); register_ea_games(mod_map); register_emule(mod_map); register_ethernetip(mod_map); register_eye(mod_map); register_facebook_turn(mod_map); register_fb_message(mod_map); register_fbcdn_ssl(mod_map); register_ffxiv(mod_map); register_filenori(mod_map); register_flash(mod_map); register_fliggy(mod_map); register_fring(mod_map); register_ftpcontrol(mod_map); register_ftpdata(mod_map); register_fuckcoin(mod_map); register_funshion_tcp(mod_map); register_gamespy_tcp(mod_map); register_gcafe_updater(mod_map); register_giop(mod_map); register_git(mod_map); register_glupteba(mod_map); register_gnutella(mod_map); register_goku(mod_map); register_googlehangouts(mod_map); register_graalonlineera(mod_map); register_guildwars2(mod_map); register_hamachi(mod_map); register_harveys(mod_map); register_hearthstone(mod_map); register_hola(mod_map); register_hots_tcp(mod_map); register_http_badport(mod_map); register_http(mod_map); register_http_nonstandard(mod_map); register_https(mod_map); register_http_tunnel(mod_map); register_ica(mod_map); register_icep(mod_map); register_id(mod_map); register_idrivesync(mod_map); register_ihexin(mod_map); register_imap(mod_map); register_imaps(mod_map); register_imesh(mod_map); register_invalid(mod_map); register_invalid_bittorrent(mod_map); register_invalid_http(mod_map); register_invalid_pop(mod_map); register_invalid_smtp(mod_map); register_ipfs(mod_map); register_ipop(mod_map); register_ipsharkk(mod_map); register_irc(mod_map); register_java(mod_map); register_jedi(mod_map); register_jx3online(mod_map); register_kakao(mod_map); register_kankan_tcp(mod_map); register_kaseya(mod_map); register_kaspersky(mod_map); register_kik(mod_map); register_kingofglory_tcp(mod_map); register_kuaibo(mod_map); register_ldap(mod_map); register_lifeforge(mod_map); register_line(mod_map); register_litecoin(mod_map); register_llp2p(mod_map); register_maplestory_china(mod_map); register_maxicloud(mod_map); register_message4u(mod_map); register_minecraft(mod_map); //register_mitglieder(mod_map); register_mms(mod_map); register_mongo(mod_map); register_mp2p(mod_map); register_msn(mod_map); register_msnc(mod_map); register_msnv(mod_map); register_munin(mod_map); register_mysql(mod_map); //register_mystery_8000(mod_map); //register_mystery_9000(mod_map); //register_mystery_conn(mod_map); //register_mystery_iG(mod_map); //register_mystery_pspr(mod_map); //register_mystery_rxxf(mod_map); //register_mystery_symantec(mod_map); register_mzinga(mod_map); register_naverp2p(mod_map); register_ncsoft(mod_map); register_ndt_tput(mod_map); register_netbios(mod_map); register_netcat_cctv(mod_map); register_netmfp(mod_map); register_nntp(mod_map); register_nntps(mod_map); register_nomachine(mod_map); register_norton_backup(mod_map); register_notes_rpc(mod_map); register_tcp_no_payload(mod_map); register_tcp_no_firstpkt(mod_map); register_nsq(mod_map); register_omegle(mod_map); register_openvpn(mod_map); register_ourworld(mod_map); register_palringo(mod_map); register_paltalk(mod_map); register_pandatv(mod_map); register_pando(mod_map); register_pathofexile(mod_map); register_pdbox(mod_map); register_pop3(mod_map); register_pop3s(mod_map); register_postgresql(mod_map); register_pptp(mod_map); register_psn_store(mod_map); register_qcloud_ilvb(mod_map); register_qq_tcp(mod_map); register_qqdownload(mod_map); register_qqlive_tcp(mod_map); register_qqspeedmobile_tcp(mod_map); register_qvod(mod_map); register_rabbitmq(mod_map); register_ragnarokonline(mod_map); register_razor(mod_map); register_rbls(mod_map); register_rdp(mod_map); register_realmofthemadgod(mod_map); register_realvnc(mod_map); register_rejection(mod_map); register_relay(mod_map); register_remote_manipulator(mod_map); register_revolver_nblbt(mod_map); register_rfb(mod_map); register_rpcscan(mod_map); register_rrtv(mod_map); register_rsync(mod_map); register_rtmp(mod_map); register_rtsp(mod_map); register_runescape(mod_map); register_s7comm(mod_map); register_saprouter(mod_map); register_saszombieassault4(mod_map); register_second_life(mod_map); register_shoutcast(mod_map); register_silkroadonline(mod_map); register_sip(mod_map); register_skyforge(mod_map); register_skype_tcp(mod_map); register_smb(mod_map); register_smite_tcp(mod_map); register_smtp(mod_map); register_smtps(mod_map); register_socks4(mod_map); register_socks5(mod_map); register_spdy(mod_map); register_speedify(mod_map); register_speedin(mod_map); register_speedtest(mod_map); register_spotify(mod_map); register_ssh(mod_map); register_ssjj(mod_map); register_ssl(mod_map); register_steam(mod_map); register_stratum(mod_map); register_stun_tcp(mod_map); register_supl(mod_map); register_svn(mod_map); register_talesrunner(mod_map); register_tankionline(mod_map); register_tankix(mod_map); register_taobao(mod_map); register_tds(mod_map); register_teamviewer(mod_map); register_telecomkey(mod_map); register_telegram(mod_map); register_telnet(mod_map); register_telnet_exploit(mod_map); register_tencent_games(mod_map); register_tenfivecoin(mod_map); register_tensafe(mod_map); register_tera(mod_map); register_tetrisonline(mod_map); register_thedivision(mod_map); register_tip(mod_map); register_tor(mod_map); register_tpkt_generic(mod_map); register_trackmania(mod_map); register_transocks(mod_map); register_trion(mod_map); register_trojan_win32_generic_sb(mod_map); register_trojan_zeroaccess(mod_map); register_twitcasting(mod_map); register_twitch_irc(mod_map); register_utherverse(mod_map); register_vainglory(mod_map); register_vhdp2p(mod_map); register_viber(mod_map); register_vmware(mod_map); register_vodlocker(mod_map); register_vpnrobot_tcp(mod_map); register_vpnunlimited_tcp(mod_map); register_warcraft3(mod_map); register_web_junk(mod_map); register_webex_stun(mod_map); register_weblogic(mod_map); register_wechat(mod_map); register_weibo(mod_map); register_weiqi(mod_map); register_whatsapp(mod_map); register_whois(mod_map); register_winmx(mod_map); register_wizard101(mod_map); register_wns(mod_map); register_wow(mod_map); register_wuala(mod_map); register_xiami(mod_map); register_xmpp(mod_map); register_xmpps(mod_map); register_xunlei(mod_map); register_xunlei_accel(mod_map); register_xymon(mod_map); register_yahoo(mod_map); register_yahoo_error(mod_map); register_yahoo_games(mod_map); register_yahoo_webcam(mod_map); register_youku_tcp(mod_map); register_yy_tcp(mod_map); register_zabbix(mod_map); register_zero_facebook(mod_map); register_zoom_tcp(mod_map); register_zynga(mod_map); return 0; } int register_udp_protocols(LPIModuleMap *mod_map) { register_360cn(mod_map); register_360p2p(mod_map); register_aachen_udp(mod_map); register_acercloud(mod_map); register_akamai(mod_map); register_akamai_transfer(mod_map); register_amanda(mod_map); register_apple_facetime_init(mod_map); register_ard(mod_map); register_ares_udp(mod_map); register_arksurvival(mod_map); register_arma_server(mod_map); register_arma3_server(mod_map); register_artcp(mod_map); register_assettocorsa(mod_map); register_avast_secure_dns(mod_map); register_bacnet(mod_map); register_backweb(mod_map); register_baiduyun_p2p(mod_map); register_baofeng_udp(mod_map); register_battlefield(mod_map); register_bjnp(mod_map); register_bmdp(mod_map); register_btsync_udp(mod_map); register_cacaoweb_udp(mod_map); register_canon_mfnp(mod_map); register_callofduty(mod_map); register_chargen_exploit(mod_map); register_checkpoint_rdp(mod_map); register_chivalry(mod_map); register_ethernetip_udp(mod_map); register_cip_io(mod_map); register_cirn(mod_map); register_cisco_ipsec(mod_map); register_cisco_sslvpn(mod_map); register_classin_udp(mod_map); register_cloudflare_warp(mod_map); register_codmobile(mod_map); register_combatarms(mod_map); register_combatarms_p2p(mod_map); register_contract_wars(mod_map); register_crossfire(mod_map); register_crossout(mod_map); register_csgo(mod_map); register_csoriginal(mod_map); register_dahua(mod_map); register_db2(mod_map); register_dcc_udp(mod_map); register_demonware(mod_map); register_destiny_udp(mod_map); register_dhcp(mod_map); register_dht_dict(mod_map); register_dht_other(mod_map); register_diablo2(mod_map); register_dianping_udp(mod_map); register_dianshijia(mod_map); register_directconnect_udp(mod_map); register_discord(mod_map); register_dns_udp(mod_map); register_dota2(mod_map); register_doyo(mod_map); register_driveshare(mod_map); register_dtls(mod_map); register_emule_udp(mod_map); //register_emule_weak_udp(mod_map); register_epson(mod_map); //register_eso(mod_map); register_esp_encap(mod_map); register_eye_udp(mod_map); register_fasp(mod_map); register_feitwo(mod_map); register_forticlient_sslvpn(mod_map); register_fortinet(mod_map); register_foscam(mod_map); register_freechal(mod_map); register_freefire(mod_map); register_funshion_udp(mod_map); register_gamespy(mod_map); register_ganglia(mod_map); register_gangsofspace(mod_map); register_garena(mod_map); register_gearsofwar(mod_map); register_gnutella_udp(mod_map); register_gnutella2_udp(mod_map); register_gnutella_weak(mod_map); register_gotomeeting(mod_map); register_gprs_tunnel(mod_map); register_gsm(mod_map); register_h1z1(mod_map); register_halflife(mod_map); register_haloonline(mod_map); register_hamachi_udp(mod_map); register_heliborne(mod_map); register_heroesevolved(mod_map); register_heroes_generals(mod_map); register_hollachat(mod_map); register_hots(mod_map); register_icp(mod_map); register_imesh_udp(mod_map); register_ipmsg(mod_map); //register_ipv6_udp(mod_map); register_isakmp(mod_map); register_jedi_academy(mod_map); register_jedi_udp(mod_map); register_kademlia(mod_map); register_kankan(mod_map); register_kaspersky_udp(mod_map); register_kazaa(mod_map); register_kingofglory_udp(mod_map); register_kugou(mod_map); register_l2tp(mod_map); register_lansync_udp(mod_map); register_ldap_ad(mod_map); register_line_udp(mod_map); register_linkproof(mod_map); register_loadout(mod_map); register_lol(mod_map); register_mdns(mod_map); register_merakicloud(mod_map); register_moh(mod_map); register_moonhunters(mod_map); register_mp2p_udp(mod_map); register_msn_cache(mod_map); register_msn_video(mod_map); register_msoffice_mac(mod_map); register_mta(mod_map); //register_mystery_05(mod_map); //register_mystery_0660(mod_map); //register_mystery_0d(mod_map); //register_mystery_45(mod_map); //register_mystery_61_72(mod_map); //register_mystery_8000_udp(mod_map); //register_mystery_99(mod_map); //register_mystery_e9(mod_map); //register_mystery_qq(mod_map); register_n2ping(mod_map); register_natpmp(mod_map); register_netbios_udp(mod_map); register_netcat_cctv_udp(mod_map); register_netcore_scan(mod_map); register_netflow(mod_map); register_newerth(mod_map); register_nintendo(mod_map); register_noction(mod_map); register_noe(mod_map); register_norton(mod_map); register_ntp(mod_map); register_ntp_reflect(mod_map); register_nwn(mod_map); register_nvidia_gamestream(mod_map); register_opaserv(mod_map); register_openvpn_udp(mod_map); register_orbit_udp(mod_map); register_overwatch(mod_map); register_paladins(mod_map); register_pando_udp(mod_map); register_panipani(mod_map); register_planetside2(mod_map); register_portmap_rpc(mod_map); register_pplive(mod_map); register_ppstream(mod_map); //register_probable_gnutella(mod_map); register_ps4_remoteplay(mod_map); register_psn(mod_map); register_punkbuster(mod_map); register_pyzor(mod_map); register_qq(mod_map); register_qqlive(mod_map); register_qqpcmgr(mod_map); register_qqspeedmobile_udp(mod_map); register_quake(mod_map); register_quic(mod_map); register_qvod_udp(mod_map); register_radius(mod_map); register_ramsey_dash(mod_map); register_rdp_udp(mod_map); register_real(mod_map); register_risingstorm(mod_map); register_raknet(mod_map); register_robocraft(mod_map); register_rocket_league(mod_map); register_rrshare(mod_map); register_rtcp(mod_map); register_rtmfp(mod_map); register_rtp(mod_map); register_rulesofsurvival(mod_map); register_sanandreas_mp(mod_map); register_second_life_udp(mod_map); register_serialnumberd(mod_map); register_sip_udp(mod_map); register_skype(mod_map); register_slp(mod_map); register_smite(mod_map); register_snapvpn(mod_map); register_snmp(mod_map); register_sopcast(mod_map); register_spamfighter(mod_map); register_spotify_bcast(mod_map); register_sql_worm(mod_map); register_ssdp(mod_map); register_starcitizen(mod_map); register_starcraft(mod_map); register_starleaf(mod_map); register_steamfriends(mod_map); register_steam_localbroadcast(mod_map); register_steam_inhomebroadcast(mod_map); register_steam_udp(mod_map); register_storm_worm(mod_map); register_stun(mod_map); register_syslog(mod_map); register_talesrunner_udp(mod_map); register_teamspeak(mod_map); register_teamviewer_udp(mod_map); register_teredo(mod_map); register_tf2(mod_map); register_tftp(mod_map); register_thecrew(mod_map); register_thq(mod_map); register_torchlight2(mod_map); register_tox(mod_map); register_traceroute(mod_map); register_tremulous(mod_map); register_turbovpn(mod_map); register_tvants(mod_map); register_ubisoft_games(mod_map); register_udp_no_payload(mod_map); register_umeye(mod_map); register_unreal(mod_map); register_ventrilo(mod_map); register_viber_udp(mod_map); register_vivox(mod_map); register_vpnmaster(mod_map); register_vpnrobot_udp(mod_map); register_vxworks_exploit(mod_map); register_warthunder(mod_map); register_webex(mod_map); register_wechat_udp(mod_map); register_winmessage(mod_map); register_wireguard(mod_map); register_wolfet(mod_map); register_worm_22105(mod_map); register_xfire_p2p(mod_map); register_xlsp(mod_map); register_xunlei_jsq(mod_map); register_xunlei_udp(mod_map); register_xunyou(mod_map); register_youdao_dict(mod_map); register_youku_udp(mod_map); register_yuanfudao(mod_map); register_yy_udp(mod_map); register_zalo_call(mod_map); register_zeroaccess_udp(mod_map); register_zoom(mod_map); return 0; } static void register_list_names(LPIModuleList *ml, LPINameMap *names, LPIProtocolMap *protos, LPICategoryProtocolMap *category_protocols) { LPIModuleList::iterator it; for (it = ml->begin(); it != ml->end(); it ++) { lpi_module_t *mod = *it; (*names)[mod->protocol] = mod->name; (*protos)[std::string(mod->name)] = mod->protocol; (*category_protocols)[mod->protocol] = mod->category; } } void register_names(LPIModuleMap *mods, LPINameMap *names, LPIProtocolMap *protocols, LPICategoryProtocolMap *category_protocols) { LPIModuleMap::iterator it; for (it = mods->begin(); it != mods->end(); it ++) { register_list_names(it->second, names, protocols, category_protocols); } } void register_category_names(LPICategoryMap *categories) { int i; for (i = 0; i < LPI_CATEGORY_LAST; i++) { (*categories)[std::string(lpi_print_category((lpi_category_t)i))] = (lpi_category_t)i; } } void init_other_protocols(LPINameMap *name_map, LPIProtocolMap *proto_map, LPICategoryProtocolMap *category_protocols) { lpi_icmp = new lpi_module_t; lpi_icmp->protocol = LPI_PROTO_ICMP; lpi_icmp->category = LPI_CATEGORY_ICMP; lpi_icmp->name = "ICMP"; lpi_icmp->priority = 255; lpi_icmp->lpi_callback = NULL; (*name_map)[lpi_icmp->protocol] = lpi_icmp->name; (*proto_map)[std::string(lpi_icmp->name)] = lpi_icmp->protocol; (*category_protocols)[lpi_icmp->protocol] = lpi_icmp->category; lpi_unknown_tcp = new lpi_module_t; lpi_unknown_tcp->protocol = LPI_PROTO_UNKNOWN; lpi_unknown_tcp->category = LPI_CATEGORY_UNKNOWN; lpi_unknown_tcp->name = "Unknown_TCP"; lpi_unknown_tcp->priority = 255; lpi_unknown_tcp->lpi_callback = NULL; (*name_map)[lpi_unknown_tcp->protocol] = lpi_unknown_tcp->name; (*proto_map)[std::string(lpi_unknown_tcp->name)] = lpi_unknown_tcp->protocol; (*category_protocols)[lpi_unknown_tcp->protocol] = lpi_unknown_tcp->category; lpi_unknown_udp = new lpi_module_t; lpi_unknown_udp->protocol = LPI_PROTO_UDP; lpi_unknown_udp->category = LPI_CATEGORY_UNKNOWN; lpi_unknown_udp->name = "Unknown_UDP"; lpi_unknown_udp->priority = 255; lpi_unknown_udp->lpi_callback = NULL; (*name_map)[lpi_unknown_udp->protocol] = lpi_unknown_udp->name; (*proto_map)[std::string(lpi_unknown_udp->name)] = lpi_unknown_udp->protocol; (*category_protocols)[lpi_unknown_udp->protocol] = lpi_unknown_udp->category; lpi_unsupported = new lpi_module_t; lpi_unsupported->protocol = LPI_PROTO_UNSUPPORTED; lpi_unsupported->category = LPI_CATEGORY_UNSUPPORTED; lpi_unsupported->name = "Unsupported"; lpi_unsupported->priority = 255; lpi_unsupported->lpi_callback = NULL; (*name_map)[lpi_unsupported->protocol] = lpi_unsupported->name; (*proto_map)[std::string(lpi_unsupported->name)] = lpi_unsupported->protocol; (*category_protocols)[lpi_unsupported->protocol] = lpi_unsupported->category; } ================================================ FILE: lib/proto_manager.h ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #ifndef PROTO_MANAGER_H_ #define PROTO_MANAGER_H_ #include #include #include #include #include "libprotoident.h" typedef std::list LPIModuleList; typedef std::map LPIModuleMap; typedef std::map LPINameMap; typedef std::map LPIProtocolMap; typedef std::map LPICategoryMap; typedef std::map LPICategoryProtocolMap; void register_protocol(lpi_module_t *mod, LPIModuleMap *mod_map); int register_tcp_protocols(LPIModuleMap *mod_map); int register_udp_protocols(LPIModuleMap *mod_map); void register_names(LPIModuleMap *mod_map, LPINameMap *name_map, LPIProtocolMap *proto_map, LPICategoryProtocolMap *category_protocols); void register_category_names(LPICategoryMap *categories); void init_other_protocols(LPINameMap *name_map, LPIProtocolMap *proto_map, LPICategoryProtocolMap *category_protocols); void free_protocols(LPIModuleMap *mod_map); extern lpi_module_t *lpi_icmp; extern lpi_module_t *lpi_unknown_tcp; extern lpi_module_t *lpi_unknown_udp; extern lpi_module_t *lpi_unsupported; #endif ================================================ FILE: lib/tcp/Makefile.am ================================================ noinst_LTLIBRARIES = libprotoident_tcp.la libprotoident_tcp_la_SOURCES = \ lpi_300heroes.cc \ lpi_360safeguard.cc \ lpi_4d.cc \ lpi_acestream.cc \ lpi_afp.cc \ lpi_airdroid.cc \ lpi_airmedia.cc \ lpi_akamai.cc \ lpi_amp.cc \ lpi_antcoin.cc \ lpi_appearin.cc \ lpi_apple_push.cc \ lpi_ares.cc \ lpi_badbaidu.cc \ lpi_baofeng_tcp.cc \ lpi_beam.cc \ lpi_bitcoin.cc \ lpi_bitextend.cc \ lpi_bittorrent.cc \ lpi_blackdesert.cc \ lpi_blizzard.cc \ lpi_btsync.cc \ lpi_bwsyncandshare.cc \ lpi_cacaoweb.cc \ lpi_cgp.cc \ lpi_chatango.cc \ lpi_cisco_vpn.cc \ lpi_clashofclans.cc \ lpi_classin_tcp.cc \ lpi_clubbox.cc \ lpi_cod_waw.cc \ lpi_conquer.cc \ lpi_crashplan.cc \ lpi_crossfire_tcp.cc \ lpi_cryptic.cc \ lpi_cvs.cc \ lpi_dahua_tcp.cc \ lpi_dash.cc \ lpi_dell_backup.cc \ lpi_destiny.cc \ lpi_diablo3.cc \ lpi_dianping_tcp.cc \ lpi_directconnect.cc \ lpi_dnf.cc \ lpi_dns.cc \ lpi_dogecoin.cc \ lpi_douyu.cc \ lpi_douyu_chat.cc \ lpi_duelingnetwork.cc \ lpi_dvrns.cc \ lpi_dxp.cc \ lpi_ea_games.cc \ lpi_emule.cc \ lpi_ethernetip.cc \ lpi_eye.cc \ lpi_facebook_turn.cc \ lpi_fb_message.cc \ lpi_fbcdn_ssl.cc \ lpi_ffxiv.cc \ lpi_filenori.cc \ lpi_flash.cc \ lpi_fliggy.cc \ lpi_fring.cc \ lpi_ftpcontrol.cc \ lpi_ftpdata.cc \ lpi_fuckcoin.cc \ lpi_funshion.cc \ lpi_gamespy.cc \ lpi_gcafe_updater.cc \ lpi_giop.cc \ lpi_git.cc \ lpi_glupteba.cc \ lpi_gnutella.cc \ lpi_goku.cc \ lpi_googlehangouts.cc \ lpi_graalonlineera.cc \ lpi_guildwars2.cc \ lpi_hamachi.cc \ lpi_harveys.cc \ lpi_hearthstone.cc \ lpi_hola.cc \ lpi_hots_tcp.cc \ lpi_http_badport.cc \ lpi_http.cc \ lpi_http_nonstandard.cc \ lpi_https.cc \ lpi_http_tunnel.cc \ lpi_ica.cc \ lpi_icep.cc \ lpi_id.cc \ lpi_idrivesync.cc \ lpi_ihexin.cc \ lpi_imap.cc \ lpi_imaps.cc \ lpi_imesh.cc \ lpi_invalid.cc \ lpi_invalid_bittorrent.cc \ lpi_invalid_http.cc \ lpi_invalid_pop.cc \ lpi_invalid_smtp.cc \ lpi_ipfs.cc \ lpi_ipop.cc \ lpi_ipsharkk.cc \ lpi_irc.cc \ lpi_java.cc \ lpi_jedi.cc \ lpi_jx3online.cc \ lpi_kakao.cc \ lpi_kankan_tcp.cc \ lpi_kaseya.cc \ lpi_kaspersky.cc \ lpi_kik.cc \ lpi_kingofglory_tcp.cc \ lpi_kuaibo.cc \ lpi_ldap.cc \ lpi_lifeforge.cc \ lpi_line.cc \ lpi_litecoin.cc \ lpi_llp2p.cc \ lpi_maplestory_china.cc \ lpi_maxicloud.cc \ lpi_message4u.cc \ lpi_minecraft.cc \ lpi_mitglieder.cc \ lpi_mms.cc \ lpi_mongo.cc \ lpi_mp2p.cc \ lpi_msn.cc \ lpi_msnc.cc \ lpi_msnv.cc \ lpi_munin.cc \ lpi_mysql.cc \ lpi_mystery_8000.cc \ lpi_mystery_9000.cc \ lpi_mystery_conn.cc \ lpi_mystery_iG.cc \ lpi_mystery_pspr.cc \ lpi_mystery_rxxf.cc \ lpi_mystery_symantec.cc \ lpi_mzinga.cc \ lpi_naverp2p.cc \ lpi_ncsoft.cc \ lpi_ndt_tput.cc \ lpi_netbios.cc \ lpi_netcat_cctv.cc \ lpi_netmfp.cc \ lpi_nntp.cc \ lpi_nntps.cc \ lpi_nomachine.cc \ lpi_nopayload.cc \ lpi_nofirstpkt.cc \ lpi_norton_backup.cc \ lpi_notes_rpc.cc \ lpi_nsq.cc \ lpi_omegle.cc \ lpi_openvpn.cc \ lpi_ourworld.cc \ lpi_palringo.cc \ lpi_paltalk.cc \ lpi_pandatv.cc \ lpi_pando.cc \ lpi_pathofexile.cc \ lpi_pdbox.cc \ lpi_pop3.cc \ lpi_pop3s.cc \ lpi_postgresql.cc \ lpi_pptp.cc \ lpi_psn_store.cc \ lpi_qcloud_ilvb.cc \ lpi_qq_tcp.cc \ lpi_qqdownload.cc \ lpi_qqlive_tcp.cc \ lpi_qqspeedmobile_tcp.cc \ lpi_qvod.cc \ lpi_rabbitmq.cc \ lpi_ragnarokonline.cc \ lpi_razor.cc \ lpi_rbls.cc \ lpi_rdp.cc \ lpi_realmofthemadgod.cc \ lpi_realvnc.cc \ lpi_rejection.cc \ lpi_relay.cc \ lpi_remote_manipulator.cc \ lpi_revolver_nblbt.cc \ lpi_rfb.cc \ lpi_rpcscan.cc \ lpi_rrtv.cc \ lpi_rsync.cc \ lpi_rtmp.cc \ lpi_rtsp.cc \ lpi_runescape.cc \ lpi_s7comm.cc \ lpi_saprouter.cc \ lpi_saszombieassault4.cc \ lpi_second_life.cc \ lpi_shoutcast.cc \ lpi_silkroadonline.cc \ lpi_sip.cc \ lpi_skyforge.cc \ lpi_skype_tcp.cc \ lpi_smb.cc \ lpi_smite_tcp.cc \ lpi_smtp.cc \ lpi_smtps.cc \ lpi_socks4.cc \ lpi_socks5.cc \ lpi_spdy.cc \ lpi_speedify.cc \ lpi_speedin.cc \ lpi_speedtest.cc \ lpi_spotify.cc \ lpi_ssh.cc \ lpi_ssjj.cc \ lpi_ssl.cc \ lpi_steam.cc \ lpi_stratum.cc \ lpi_stun.cc \ lpi_supl.cc \ lpi_svn.cc \ lpi_talesrunner.cc \ lpi_tankionline.cc \ lpi_tankix.cc \ lpi_taobao.cc \ lpi_tds.cc \ lpi_teamviewer.cc \ lpi_telecomkey.cc \ lpi_telegram.cc \ lpi_telnet.cc \ lpi_telnet_exploit.cc \ lpi_tencent_games.cc \ lpi_tenfivecoin.cc \ lpi_tensafe.cc \ lpi_tera.cc \ lpi_tetrisonline.cc \ lpi_thedivision.cc \ lpi_tip.cc \ lpi_tor.cc \ lpi_tpkt.cc \ lpi_trackmania.cc \ lpi_transocks.cc \ lpi_trion.cc \ lpi_trojan_win32_generic_sb.cc \ lpi_trojan_zeroaccess.cc \ lpi_twitcasting.cc \ lpi_twitch_irc.cc \ lpi_utherverse.cc \ lpi_vainglory.cc \ lpi_vhdp2p.cc \ lpi_viber.cc \ lpi_vmware.cc \ lpi_vodlocker.cc \ lpi_vpnrobot_tcp.cc \ lpi_vpnunlimited_tcp.cc \ lpi_warcraft3.cc \ lpi_web_junk.cc \ lpi_webex_stun.cc \ lpi_weblogic.cc \ lpi_wechat.cc \ lpi_weibo.cc \ lpi_weiqi.cc \ lpi_whatsapp.cc \ lpi_whois.cc \ lpi_winmx.cc \ lpi_wizard101.cc \ lpi_wns.cc \ lpi_wow.cc \ lpi_wuala.cc \ lpi_xiami.cc \ lpi_xmpp.cc \ lpi_xmpps.cc \ lpi_xunlei.cc \ lpi_xunlei_accel.cc \ lpi_xymon.cc \ lpi_yahoo.cc \ lpi_yahoo_error.cc \ lpi_yahoo_games.cc \ lpi_yahoo_webcam.cc \ lpi_youku.cc \ lpi_yy_tcp.cc \ lpi_zabbix.cc \ lpi_zero.cc \ lpi_zoom_tcp.cc \ lpi_zynga.cc EXTRA_DIST=tcp_protocols.h libprotoident_tcp_la_CFLAGS=-I"$(top_srcdir)/lib" libprotoident_tcp_la_CPPFLAGS=-I"$(top_srcdir)/lib" INCLUDES=@ADD_INCLS@ ================================================ FILE: lib/tcp/lpi_300heroes.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Yet another Chinese LoL clone */ static inline bool match_heroes_c1(uint32_t payload, uint32_t len) { if (len == 12 && MATCH(payload, 0xc1, 0x0c, 0x00, 0x00)) return true; return false; } static inline bool match_heroes_c2(uint32_t payload, uint32_t len) { if (len == 15 && MATCH(payload, 0xc2, 0x0f, 0x00, 0x00)) return true; return false; } static inline bool match_heroes_db(uint32_t payload, uint32_t len) { if (len == 22 && MATCH(payload, 0xdb, 0x16, 0x00, 0x00)) return true; return false; } static inline bool match_heroes_e7(uint32_t payload, uint32_t len) { if (MATCH(payload, 0xe7, 0x2a, 0x00, 0x00)) { if (len >= 185 && len <= 200) return true; } return false; } static inline bool match_300heroes(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_heroes_c1(data->payload[0], data->payload_len[0])) { if (match_heroes_c2(data->payload[1], data->payload_len[1])) return true; } if (match_heroes_c1(data->payload[1], data->payload_len[1])) { if (match_heroes_c2(data->payload[0], data->payload_len[0])) return true; } if (match_heroes_db(data->payload[0], data->payload_len[0])) { if (match_heroes_e7(data->payload[1], data->payload_len[1])) return true; } if (match_heroes_db(data->payload[1], data->payload_len[1])) { if (match_heroes_e7(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_300heroes = { LPI_PROTO_300_HEROES, LPI_CATEGORY_GAMING, "300Heroes", 101, match_300heroes }; void register_300heroes(LPIModuleMap *mod_map) { register_protocol(&lpi_300heroes, mod_map); } ================================================ FILE: lib/tcp/lpi_360safeguard.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_360_a1req(uint32_t payload, uint32_t len) { if (len != 63) return false; if (MATCH(payload, 0xa1, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_360_a1resp(uint32_t payload, uint32_t len) { if (MATCH(payload, 0xa1, 0x82, 0x00, 0x00)) return true; return false; } static inline bool match_360_03req(uint32_t payload, uint32_t len) { uint32_t hdrlen = (ntohl(payload) & 0xffff); if (!MATCH(payload, 0x00, 0x03, 0x00, ANY)) return false; if (len - 8 == hdrlen) return true; return false; } static inline bool match_360_03resp(uint32_t payload, uint32_t len) { if (len != 8) return false; if (MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_360_p2pupdate(uint32_t payload, uint32_t len) { if (len == 68 && MATCH(payload, 0x01, 0xaa, 0x4b, 0x79)) return true; return false; } static inline bool match_360safeguard(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* These patterns have been regularly seen on a machine with 360 * safeguard (Chinese edition) installed. They seem to appear when * starting up and running a scan, so are probably some form of update * checking? */ if (match_360_a1req(data->payload[0], data->payload_len[0])) { if (match_360_a1resp(data->payload[1], data->payload_len[1])) return true; } if (match_360_a1req(data->payload[1], data->payload_len[1])) { if (match_360_a1resp(data->payload[0], data->payload_len[0])) return true; } if (match_360_03req(data->payload[0], data->payload_len[0])) { if (match_360_03resp(data->payload[1], data->payload_len[1])) return true; } if (match_360_03req(data->payload[1], data->payload_len[1])) { if (match_360_03resp(data->payload[0], data->payload_len[0])) return true; } /* Have observed unencrypted traffic that appears to be downloading a * .cab file to update 360 safeguard. */ if (match_360_p2pupdate(data->payload[0], data->payload_len[0])) { if (match_360_p2pupdate(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_360safeguard = { LPI_PROTO_360SAFEGUARD, LPI_CATEGORY_SECURITY, "360Safeguard", 8, match_360safeguard }; void register_360safeguard(LPIModuleMap *mod_map) { register_protocol(&lpi_360safeguard, mod_map); } ================================================ FILE: lib/tcp/lpi_4d.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_4d_5f(uint32_t payload, uint32_t len) { if (len == 4 && MATCH(payload, 0x5f, 0x11, 0x00, 0x00)) return true; return false; } static inline bool match_4d_other(uint32_t payload, uint32_t len) { if (len == 4 && MATCH(payload, 0x60, 0x11, 0x00, 0x00)) return true; if (len == 4 && MATCH(payload, 0x61, 0x11, 0x00, 0x00)) return true; return false; } static inline bool match_4d_len72(uint32_t payload, uint32_t len) { if (len == 72 && MATCH(payload, 0x00, 0x00, 0x00, 0x48)) return true; return false; } static inline bool match_4d_len12(uint32_t payload, uint32_t len) { if (len == 12 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_4d(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_4d_5f(data->payload[0], data->payload_len[0])) { if (match_4d_other(data->payload[1], data->payload_len[1])) return true; } if (match_4d_5f(data->payload[1], data->payload_len[1])) { if (match_4d_other(data->payload[0], data->payload_len[0])) return true; } if (match_4d_len72(data->payload[0], data->payload_len[0])) { if (match_4d_len12(data->payload[1], data->payload_len[1])) return true; } if (match_4d_len72(data->payload[1], data->payload_len[1])) { if (match_4d_len12(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_4d = { LPI_PROTO_4D, LPI_CATEGORY_DATABASES, "4D", 75, match_4d }; void register_4d(LPIModuleMap *mod_map) { register_protocol(&lpi_4d, mod_map); } ================================================ FILE: lib/tcp/lpi_acestream.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ace_greet(uint32_t payload, uint32_t len) { if (len == 46 && MATCH(payload, 0x11, 'A', 'c', 'e')) return true; return false; } static inline bool match_ace_66(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len == 66 && MATCH(payload, 0x11, 'A', 'c', 'e')) return true; return false; } static inline bool match_acestream(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_ace_greet(data->payload[0], data->payload_len[0])) { if (match_ace_greet(data->payload[1], data->payload_len[1])) { return true; } if (match_ace_66(data->payload[1], data->payload_len[1])) { return true; } } return false; } static lpi_module_t lpi_acestream = { LPI_PROTO_ACESTREAM, LPI_CATEGORY_P2P, "AceStream", 6, match_acestream }; void register_acestream(LPIModuleMap *mod_map) { register_protocol(&lpi_acestream, mod_map); } ================================================ FILE: lib/tcp/lpi_afp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_afp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Looking for a DSI header - command 4 is OpenSession */ if (match_str_both(data, "\x00\x04\x00\x01", "\x01\x04\x00\x01")) return true; return false; } static lpi_module_t lpi_afp = { LPI_PROTO_AFP, LPI_CATEGORY_FILES, "AFP", 5, match_afp }; void register_afp(LPIModuleMap *mod_map) { register_protocol(&lpi_afp, mod_map); } ================================================ FILE: lib/tcp/lpi_airdroid.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_airdroid_req(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x2a, 0x33, 0x0d, 0x0a)) { if (len == 97) return true; } if (MATCH(payload, 0x2a, 0x35, 0x0d, 0x0a)) { if (len == 118 || len == 119) return true; } return false; } static inline bool match_airdroid_resp(uint32_t payload, uint32_t len) { if (len != 4) return false; if (MATCH(payload, 0x2b, 0x68, 0x0d, 0x0a)) return true; return false; } static inline bool match_airdroid_get(uint32_t payload) { if (MATCH(payload, 'G', 'E', 'T', 0x20)) return true; return false; } static inline bool is_hexdigit(uint32_t byte) { if (byte < 0x30) return false; if (byte > 0x39 && byte < 0x61) return false; if (byte > 0x66) return false; return true; } static inline bool match_airdroid_33(uint32_t payload, uint32_t len) { uint32_t ordered = ntohl(payload); uint32_t byte; /* Needs some proper testing against real airdroid traffic */ if (len == 33) { byte = (ordered & 0xff); if (!is_hexdigit(byte)) return false; byte = ((ordered >> 8) & 0xff); if (!is_hexdigit(byte)) return false; byte = ((ordered >> 16) & 0xff); if (!is_hexdigit(byte)) return false; byte = ((ordered >> 24) & 0xff); if (!is_hexdigit(byte)) return false; return true; } return false; } static inline bool match_airdroid(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_airdroid_req(data->payload[0], data->payload_len[0])) { if (match_airdroid_resp(data->payload[1], data->payload_len[1])) return true; } if (match_airdroid_req(data->payload[1], data->payload_len[1])) { if (match_airdroid_resp(data->payload[0], data->payload_len[0])) return true; } if (data->server_port == 9991 || data->client_port == 9991) { if (match_airdroid_33(data->payload[0], data->payload_len[0])) { if (match_airdroid_get(data->payload[1])) return true; } if (match_airdroid_33(data->payload[1], data->payload_len[1])) { if (match_airdroid_get(data->payload[0])) return true; } } return false; } static lpi_module_t lpi_airdroid = { LPI_PROTO_AIRDROID, LPI_CATEGORY_CLOUD, "AirDroid", 12, match_airdroid }; void register_airdroid(LPIModuleMap *mod_map) { register_protocol(&lpi_airdroid, mod_map); } ================================================ FILE: lib/tcp/lpi_airmedia.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Crestron Airmedia -- more details at: * http://www.boredhackerblog.info/2016/02/extracting-images-from-crestron.html */ static inline bool match_cam_wppi(uint32_t payload, uint32_t len) { if (len == 12 && MATCHSTR(payload, "wppi")) return true; return false; } static inline bool match_cam_sender(uint32_t payload, uint32_t len) { if (len == 32 && MATCHSTR(payload, "Send")) return true; return false; } static inline bool match_airmedia(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 515 */ if (match_cam_wppi(data->payload[0], data->payload_len[0])) { if (match_cam_sender(data->payload[1], data->payload_len[1])) return true; } if (match_cam_wppi(data->payload[1], data->payload_len[1])) { if (match_cam_sender(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_airmedia = { LPI_PROTO_AIRMEDIA, LPI_CATEGORY_REMOTE, "Airmedia", 5, match_airmedia }; void register_airmedia(LPIModuleMap *mod_map) { register_protocol(&lpi_airmedia, mod_map); } ================================================ FILE: lib/tcp/lpi_akamai.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_akamai_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* TCP exchanges between Akamai nodes */ /* Seems to always be over port 9050, so add a check if too many * false positives */ /* Payload is 00000000 in both directions */ if (data->payload[0] != 0 || data->payload[0] != 0) return false; if (data->payload_len[0] == 163 && data->payload_len[1] == 149) return true; if (data->payload_len[1] == 163 && data->payload_len[0] == 149) return true; return false; } static lpi_module_t lpi_akamai_tcp = { LPI_PROTO_AKAMAI, LPI_CATEGORY_CDN, "AkamaiTCP", 9, match_akamai_tcp }; void register_akamai_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_akamai_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_amp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_amp_throughput(lpi_data_t *data) { /* AMP Throughput generally uses port 8826 or 8827 */ if (data->server_port != 8826 && data->client_port != 8826 && data->server_port != 8827 && data->client_port != 8827) return false; /* AMP Throughput tests are large one-way data transfers */ if (data->payload_len[0] != 0 && data->payload_len[1] != 0) return false; /* Packets are always going to be MSS-sized -- assume MTU is no * smaller than 1280 bytes */ if (data->payload_len[0] < 1240 && data->payload_len[1] < 1240) return false; return true; } static inline bool match_amp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_amp_throughput(data)) return true; return false; } static lpi_module_t lpi_amp = { LPI_PROTO_AMP, LPI_CATEGORY_MONITORING, "AMP", 240, /* AMP is not something I'd expect to see outside of Waikato */ match_amp }; void register_amp(LPIModuleMap *mod_map) { register_protocol(&lpi_amp, mod_map); } ================================================ FILE: lib/tcp/lpi_antcoin.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_antcoin(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* port 10333 */ if (MATCH(data->payload[0], 'A', 'n', 't', 0x00)) { if (MATCH(data->payload[1], 'A', 'n', 't', 0x00)) return true; } return false; } static lpi_module_t lpi_antcoin = { LPI_PROTO_ANTCOIN, LPI_CATEGORY_ECOMMERCE, "AntCoin", 5, match_antcoin }; void register_antcoin(LPIModuleMap *mod_map) { register_protocol(&lpi_antcoin, mod_map); } ================================================ FILE: lib/tcp/lpi_appearin.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Signalling protocol (?) used by appear.in, a WebRTC based video * conferencing system. */ static inline bool match_appear_req(uint32_t payload, uint32_t len) { uint32_t hlen = ntohl(payload) & 0xffff; /* Usually 28 bytes */ if (hlen == len - 20 && MATCH(payload, 0x00, 0x03, 0x00, ANY)) return true; return false; } static inline bool match_appear_resp(uint32_t payload, uint32_t len) { uint32_t hlen = ntohl(payload) & 0xffff; /* Usually 92 bytes */ if (hlen == len - 20 && MATCH(payload, 0x01, 0x13, 0x00, ANY)) return true; return false; } static inline bool match_appearin(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 443 && data->client_port != 443) return false; if (match_appear_req(data->payload[0], data->payload_len[0])) { if (match_appear_resp(data->payload[1], data->payload_len[1])) return true; } if (match_appear_req(data->payload[1], data->payload_len[1])) { if (match_appear_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_appearin = { LPI_PROTO_APPEAR_IN, LPI_CATEGORY_VOIP, "Appear.in", 120, match_appearin }; void register_appearin(LPIModuleMap *mod_map) { register_protocol(&lpi_appearin, mod_map); } ================================================ FILE: lib/tcp/lpi_apple_push.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_apple_push(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This rule matches the push notifications sent to IOS devices */ if (!match_ssl(data)) return false; /* Port 5223 is used for the push notifications */ if (data->server_port != 5223 && data->client_port != 5223) return false; /* If payload is only one-way, fall back to SSL to avoid risking * a false positive for other port 5223 SSL apps, e.g. Kik */ if (data->payload_len[0] == 0 || data->payload_len[1] == 0) return false; /* Too much size variation to write a good set of rules based on * payload sizes, just use this as the fallback option for all * SSL traffic on 5223 that doesn't match something else, e.g. * PSN store */ return true; } static lpi_module_t lpi_apple_push = { LPI_PROTO_APPLE_PUSH, LPI_CATEGORY_NOTIFICATION, "ApplePush", 8, /* Should be a higher priority than regular SSL, but lower than anything else on port 5223 */ match_apple_push }; void register_apple_push(LPIModuleMap *mod_map) { register_protocol(&lpi_apple_push, mod_map); } ================================================ FILE: lib/tcp/lpi_ares.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ares_client(uint32_t payload, uint32_t len) { if (len != 6) return false; if (!MATCH(payload, 0x03, 0x00, 0x5a, 0x06)) return false; return true; } static inline bool match_ares_peer(uint32_t payload, uint32_t len) { if (len != 138) return false; if (MATCH(payload, 0x87, 0x00, 0x3c, ANY)) return true; if (MATCH(payload, 0x87, 0x00, 0x3b, ANY)) return true; return false; } static inline bool match_ares(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Pretty sure this is the ARES p2p protocol */ if (match_str_either(data, "ARES")) return true; if (match_ares_client(data->payload[0], data->payload_len[0])) { if (match_ares_peer(data->payload[1], data->payload_len[1])) return true; } if (match_ares_client(data->payload[1], data->payload_len[1])) { if (match_ares_peer(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_ares = { LPI_PROTO_ARES, LPI_CATEGORY_P2P, "Ares", 8, match_ares }; void register_ares(LPIModuleMap *mod_map) { register_protocol(&lpi_ares, mod_map); } ================================================ FILE: lib/tcp/lpi_badbaidu.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Strange flows that seem to be related to users running the Baidu browser. * The flow will connect to a Baidu server on port 80, send no data, then * start sending FINs. After about 6 FINs, the client will then send a one * byte packet with a sequence number matching the original SYN (which is * of course completely invalid). At this point, the server usually terminates * the connection. * * Confirmed as being associated with Baidu browser after observing this * exact traffic after installing the browser. * * Not sure what the purpose of this is, or how the browser manages to send * invalid TCP traffic but it is the root cause behind a lot of non-HTTP * flows on TCP port 80. */ static inline bool match_badbaidu(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Only seen on port 80 */ if (data->client_port != 80 && data->server_port != 80) return false; /* Packet is one byte; the byte itself is 0x00. The other end * does not send any payload. */ if (data->payload_len[0] == 0 && data->payload_len[1] == 1) { if (MATCH(data->payload[1], 0x00, 0x00, 0x00, 0x00)) return true; } if (data->payload_len[1] == 0 && data->payload_len[0] == 1) { if (MATCH(data->payload[0], 0x00, 0x00, 0x00, 0x00)) return true; } return false; } static lpi_module_t lpi_badbaidu = { LPI_PROTO_BADBAIDU, LPI_CATEGORY_MALWARE, "BadBaidu", 100, match_badbaidu }; void register_badbaidu(LPIModuleMap *mod_map) { register_protocol(&lpi_badbaidu, mod_map); } ================================================ FILE: lib/tcp/lpi_baofeng_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_baofeng_52(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x52, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_baofeng_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port == 7909 || data->client_port == 7909) { if (match_baofeng_52(data->payload[1], data->payload_len[1])) { if (match_baofeng_52(data->payload[0], data->payload_len[0])) return true; } } if (data->server_port == 8189 || data->client_port == 8189) { if (data->payload_len[0] == 63 && data->payload_len[1] == 152) return true; if (data->payload_len[1] == 63 && data->payload_len[0] == 152) return true; } return false; } static lpi_module_t lpi_baofeng_tcp = { LPI_PROTO_BAOFENG, LPI_CATEGORY_STREAMING, "Baofeng", 105, match_baofeng_tcp }; void register_baofeng_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_baofeng_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_beam.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_bm(uint32_t payload, uint32_t len) { if (len == 40 && MATCH(payload, 'B', 'm', 0x0a, 0x04)) { return true; } return false; } static inline bool match_beam(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 8100 && data->client_port != 8100) { return false; } if (match_bm(data->payload[0], data->payload_len[0])) { if (match_bm(data->payload[1], data->payload_len[1])) { return true; } } return false; } static lpi_module_t lpi_beam = { LPI_PROTO_BEAM, LPI_CATEGORY_ECOMMERCE, "Beam", 25, match_beam }; void register_beam(LPIModuleMap *mod_map) { register_protocol(&lpi_beam, mod_map); } ================================================ FILE: lib/tcp/lpi_bitcoin.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_bc_version(uint32_t payload, uint32_t len) { if (len >= 24 && MATCH(payload, 0xf9, 0xbe, 0xb4, 0xd9)) return true; return false; } static inline bool match_bc_version_reply(uint32_t payload, uint32_t len) { if (len >= 24 && MATCH(payload, 0xf9, 0xbe, 0xb4, 0xd9)) return true; return false; } static inline bool match_bitcoin(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_bc_version(data->payload[0], data->payload_len[0])) { if (match_bc_version_reply(data->payload[1], data->payload_len[1])) return true; } if (match_bc_version(data->payload[1], data->payload_len[1])) { if (match_bc_version_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_bitcoin = { LPI_PROTO_BITCOIN, LPI_CATEGORY_ECOMMERCE, "Bitcoin", 5, match_bitcoin }; void register_bitcoin(LPIModuleMap *mod_map) { register_protocol(&lpi_bitcoin, mod_map); } ================================================ FILE: lib/tcp/lpi_bitextend.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Bittorrent extensions (?) * * TODO Find some good references for this */ static inline bool match_bitextend(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "\x0\x0\x0\xd", "\x0\x0\x0\x1")) return true; if (match_str_both(data, "\x0\x0\x0\x3", "\x0\x0\x0\x38")) return true; if (match_str_both(data, "\x0\x0\x0\x3", "\x0\x0\x0\x39")) return true; if (match_str_both(data, "\x0\x0\x0\x3", "\x0\x0\x0\x3")) return true; if (match_str_both(data, "\x0\x0\x0\x4e", "\x0\x0\x0\xb2")) return true; if (match_chars_either(data, 0x00, 0x00, 0x40, 0x09)) return true; if (MATCH(data->payload[0], 0x00, 0x00, 0x01, ANY) && MATCH(data->payload[1], 0x00, 0x00, 0x00, 0x38)) return true; if (MATCH(data->payload[1], 0x00, 0x00, 0x01, ANY) && MATCH(data->payload[0], 0x00, 0x00, 0x00, 0x38)) return true; if (MATCH(data->payload[0], 0x00, 0x00, 0x00, ANY) && MATCH(data->payload[1], 0x00, 0x00, 0x00, 0x05)) return true; if (MATCH(data->payload[1], 0x00, 0x00, 0x00, ANY) && MATCH(data->payload[0], 0x00, 0x00, 0x00, 0x05)) return true; if (MATCH(data->payload[0], 0x01, 0x00, ANY, 0x68) && MATCH(data->payload[1], 0x00, 0x00, 0x00, 0x05)) return true; if (MATCH(data->payload[1], 0x01, 0x00, ANY, 0x68) && MATCH(data->payload[0], 0x00, 0x00, 0x00, 0x05)) return true; return false; } static lpi_module_t lpi_bitextend = { LPI_PROTO_BITEXT, LPI_CATEGORY_P2P, "Bittorrent_Extension", 5, /* This is probably fine, but I'd rather have this at 5 than 2 */ match_bitextend }; void register_bitextend(LPIModuleMap *mod_map) { register_protocol(&lpi_bitextend, mod_map); } ================================================ FILE: lib/tcp/lpi_bittorrent.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_bittorrent_header(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 0x13, 'B', 'i', 't')) return true; if (len == 3 && MATCH(payload, 0x13, 'B', 'i', 0x00)) return true; if (len == 2 && MATCH(payload, 0x13, 'B', 0x00, 0x00)) return true; if (len == 1 && MATCH(payload, 0x13, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_ww_xx_header(uint32_t payload, uint32_t len) { /* Fairly confident that this is related to Bittorrent, though I * can't seem to find any source code or documentation that references * it. * * The full string included in the header is: * 0x13 #WW-XX#@77 */ if (len == 0) return true; if (MATCH(payload, 0x13, 0x23, 0x57, 0x57)) return true; return false; } static inline bool match_bittorrent(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_bittorrent_header(data->payload[0], data->payload_len[0])) { if (match_bittorrent_header(data->payload[1], data->payload_len[1])) return true; } if (match_ww_xx_header(data->payload[0], data->payload_len[0])) { if (match_ww_xx_header(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_bittorrent = { LPI_PROTO_BITTORRENT, LPI_CATEGORY_P2P, "BitTorrent", 2, match_bittorrent }; void register_bittorrent(LPIModuleMap *mod_map) { register_protocol(&lpi_bittorrent, mod_map); } ================================================ FILE: lib/tcp/lpi_blackdesert.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* First two bytes definitely look like a little-endian length * field, so we could use that to match more reply types */ /* Port 9991, 9992 and 9993 */ static inline bool match_bdo_request(uint32_t payload, uint32_t len) { if (len == 111 && MATCH(payload, 0x6f, 0x00, 0x01, 0x9d)) return true; if (len == 111 && MATCH(payload, 0x6f, 0x00, 0x01, 0x46)) return true; if (len == 277 && MATCH(payload, 0x15, 0x01, 0x01, ANY)) return true; if (len == 433 && MATCH(payload, 0xb1, 0x01, 0x01, ANY)) return true; return false; } static inline bool match_bdo_reply(uint32_t payload, uint32_t len) { if (len == 112 && MATCH(payload, 0x70, 0x00, 0x01, ANY)) return true; if (len == 113 && MATCH(payload, 0x71, 0x00, 0x01, ANY)) return true; if (len == 119 && MATCH(payload, 0x77, 0x00, 0x01, 0x46)) return true; return false; } static inline bool match_blackdesert(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_bdo_request(data->payload[0], data->payload_len[0])) { if (match_bdo_reply(data->payload[1], data->payload_len[1])) return true; } if (match_bdo_request(data->payload[1], data->payload_len[1])) { if (match_bdo_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_blackdesert = { LPI_PROTO_BLACKDESERT, LPI_CATEGORY_GAMING, "BlackDesertOnline", 12, match_blackdesert }; void register_blackdesert(LPIModuleMap *mod_map) { register_protocol(&lpi_blackdesert, mod_map); } ================================================ FILE: lib/tcp/lpi_blizzard.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_bnet_auth_req(uint32_t payload, uint32_t len) { if (len >= 160 && len <= 170 && MATCH(payload, 0x00, 0x0a, 0x08, 0xfe)) return true; return false; } static inline bool match_bnet_auth_resp(uint32_t payload, uint32_t len) { if (len == 184 || len == 199) { if (MATCH(payload, 0x00, 0x09, 0x08, 0x00)) return true; } return false; } static inline bool match_blizzard(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "\x10\xdf\x22\x00", "\x10\x00\x00\x00")) return true; if (MATCH(data->payload[0], 0x00, ANY, 0xed, 0x01) && MATCH(data->payload[1], 0x00, 0x06, 0xec, 0x01)) return true; if (MATCH(data->payload[1], 0x00, ANY, 0xed, 0x01) && MATCH(data->payload[0], 0x00, 0x06, 0xec, 0x01)) return true; /* More up to date battle.net authentication protocol */ if (match_bnet_auth_req(data->payload[0], data->payload_len[0])) { if (match_bnet_auth_resp(data->payload[1], data->payload_len[1])) return true; } if (match_bnet_auth_req(data->payload[1], data->payload_len[1])) { if (match_bnet_auth_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_blizzard = { LPI_PROTO_BLIZZARD, LPI_CATEGORY_GAMING, "Blizzard", 2, match_blizzard }; void register_blizzard(LPIModuleMap *mod_map) { register_protocol(&lpi_blizzard, mod_map); } ================================================ FILE: lib/tcp/lpi_btsync.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_btsync(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "BSYN")) return true; return false; } static lpi_module_t lpi_btsync = { LPI_PROTO_BTSYNC, LPI_CATEGORY_FILES, "BitTorrentSync", 8, match_btsync }; void register_btsync(LPIModuleMap *mod_map) { register_protocol(&lpi_btsync, mod_map); } ================================================ FILE: lib/tcp/lpi_bwsyncandshare.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Have not tested against the application itself, as it is restricted * to certain German universities. There may be more variants of this * traffic. */ static inline bool match_bws_951(uint32_t payload, uint32_t len) { if (len == 4 && MATCH(payload, 0x00, 0x00, 0x09, 0x51)) return true; return false; } static inline bool match_bws_other(uint32_t payload, uint32_t len) { uint32_t lastbyte = ntohl(payload) & 0x000000ff; if (len == 4 && MATCH(payload, 0x00, 0x00, 0x08, ANY)) { /* Byte 4 is always 0xfX, where X can be just about * anything. */ if ((lastbyte & 0xf0) == 0xf0) return true; } return false; } static inline bool match_bwsyncandshare(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 60107? */ if (match_bws_951(data->payload[0], data->payload_len[0])) { if (match_bws_other(data->payload[1], data->payload_len[1])) return true; } if (match_bws_951(data->payload[1], data->payload_len[1])) { if (match_bws_other(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_bwsyncandshare = { LPI_PROTO_BWSYNC, LPI_CATEGORY_CLOUD, "BWSyncAndShare", 120, match_bwsyncandshare }; void register_bwsyncandshare(LPIModuleMap *mod_map) { register_protocol(&lpi_bwsyncandshare, mod_map); } ================================================ FILE: lib/tcp/lpi_cacaoweb.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_cacaoweb_header(uint32_t payload, uint32_t len) { if (!MATCH(payload, 0x84, 0x95, 0xa6, 0xbe)) return false; if (len >= 51 && len <= 56) return true; if (len == 91) return true; return false; } static inline bool match_cacaoweb(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_cacaoweb_header(data->payload[0], data->payload_len[0])) { if (match_cacaoweb_header(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_cacaoweb = { LPI_PROTO_CACAOWEB, LPI_CATEGORY_P2P, "CacaoWeb", 5, match_cacaoweb }; void register_cacaoweb(LPIModuleMap *mod_map) { register_protocol(&lpi_cacaoweb, mod_map); } ================================================ FILE: lib/tcp/lpi_cgp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_cgp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Citrix CGP is a special version of ICA that runs on TCP port * 2598 */ if (match_str_both(data, "\x1a""CGP", "\x1a""CGP")) return true; return false; } static lpi_module_t lpi_cgp = { LPI_PROTO_CGP, LPI_CATEGORY_REMOTE, "CitrixCGP", 3, match_cgp }; void register_cgp(LPIModuleMap *mod_map) { register_protocol(&lpi_cgp, mod_map); } ================================================ FILE: lib/tcp/lpi_chatango.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_chatango_in(uint32_t payload, uint32_t len) { if (len != 2) return false; if (!MATCH(payload, 'v', 0x00, 0x00, 0x00)) return false; return true; } static inline bool match_chatango_out(uint32_t payload, uint32_t len) { if (len != 10) return false; if (MATCH(payload, 'v', ':', '1', '0')) return true; if (MATCH(payload, 'v', ':', '1', '4')) return true; return false; } static inline bool match_chatango(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_chatango_out(data->payload[0], data->payload_len[0])) { if (match_chatango_in(data->payload[1], data->payload_len[1])) return true; } if (match_chatango_in(data->payload[0], data->payload_len[0])) { if (match_chatango_out(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_chatango = { LPI_PROTO_CHATANGO, LPI_CATEGORY_CHAT, "Chatango", 3, match_chatango }; void register_chatango(LPIModuleMap *mod_map) { register_protocol(&lpi_chatango, mod_map); } ================================================ FILE: lib/tcp/lpi_cisco_vpn.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_cisco_vpn_server(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 0x01, 0xf4, ANY, ANY)) return true; return false; } static inline bool match_cisco_vpn_client(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, ANY, ANY, 0x01, 0xf4)) return true; return false; } static inline bool match_cisco_vpn(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_cisco_vpn_server(data->payload[0], data->payload_len[0])) { if (match_cisco_vpn_client(data->payload[1], data->payload_len[1])) return true; } if (match_cisco_vpn_server(data->payload[1], data->payload_len[1])) { if (match_cisco_vpn_client(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_cisco_vpn = { LPI_PROTO_CISCO_VPN, LPI_CATEGORY_TUNNELLING, "Cisco_VPN", 7, match_cisco_vpn }; void register_cisco_vpn(LPIModuleMap *mod_map) { register_protocol(&lpi_cisco_vpn, mod_map); } ================================================ FILE: lib/tcp/lpi_clashofclans.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_coc_login(uint32_t payload, uint32_t len) { /* First two bytes are 10101 (0x2775) or 10100 (0x2774) * Next three bytes are a length field, usually 250-330 bytes */ if (MATCH(payload, 0x27, 0x75, 0x00, 0x01)) return true; if (MATCH(payload, 0x27, 0x75, 0x00, 0x00)) return true; if (MATCH(payload, 0x27, 0x74, 0x00, 0x01)) return true; if (MATCH(payload, 0x27, 0x74, 0x00, 0x00)) return true; return false; } static inline bool match_coc_encrypt(uint32_t payload, uint32_t len) { /* First two bytes are 20000 (0x4e20) or 20100 (0x4e84) * Next three bytes are a length field, always seems to be just * under 256 bytes */ if (MATCH(payload, 0x4e, 0x20, 0x00, 0x00)) return true; if (MATCH(payload, 0x4e, 0x84, 0x00, 0x00)) return true; return false; } static inline bool match_clashofclans(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Could limit this to port 9339, but the pattern is probably strong * enough by itself */ /* Actually, port 1863 is also used... */ if (match_coc_login(data->payload[0], data->payload_len[0])) { if (match_coc_encrypt(data->payload[1], data->payload_len[1])) return true; } if (match_coc_login(data->payload[1], data->payload_len[1])) { if (match_coc_encrypt(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_clashofclans = { LPI_PROTO_CLASH_OF_CLANS, LPI_CATEGORY_GAMING, "ClashOfClans", 4, match_clashofclans }; void register_clashofclans(LPIModuleMap *mod_map) { register_protocol(&lpi_clashofclans, mod_map); } ================================================ FILE: lib/tcp/lpi_classin_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_classin_41(uint32_t payload, uint32_t len) { if (len == 41 && MATCH(payload, 0x1a, 0x03, 0x00, 0x02)) { return true; } return false; } static inline bool match_classin_52(uint32_t payload, uint32_t len) { if (len == 52 && MATCH(payload, 0x1a, 0x03, 0x00, 0x02)) { return true; } return false; } static inline bool match_classin_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_classin_41(data->payload[0], data->payload_len[0])) { if (match_classin_52(data->payload[1], data->payload_len[1])) { return true; } } if (match_classin_41(data->payload[1], data->payload_len[1])) { if (match_classin_52(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_classin_tcp = { LPI_PROTO_CLASSIN, LPI_CATEGORY_EDUCATIONAL, "ClassIn_TCP", 133, match_classin_tcp }; void register_classin_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_classin_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_clubbox.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_clubbox(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_str_both(data, "\x00\x00\x01\x03", "\x00\x00\x01\x03")) return false; if (data->payload_len[0] == 36 && data->payload_len[1] == 28) return true; if (data->payload_len[1] == 36 && data->payload_len[0] == 28) return true; return false; } static lpi_module_t lpi_clubbox = { LPI_PROTO_CLUBBOX, LPI_CATEGORY_P2P, "Clubbox", 3, match_clubbox }; void register_clubbox(LPIModuleMap *mod_map) { register_protocol(&lpi_clubbox, mod_map); } ================================================ FILE: lib/tcp/lpi_cod_waw.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_cod_waw(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Call of Duty: World at War uses TCP port 3074 - the protocol isn't * well documented, but traffic matching this pattern goes to known * CoD servers */ if (data->server_port != 3074 && data->client_port != 3074) return false; if (data->payload_len[0] != 4 || data->payload_len[1] != 4) return false; if (data->payload[0] != 0 || data->payload[1] != 0) return false; return true; } static lpi_module_t lpi_cod_waw = { LPI_PROTO_COD_WAW, LPI_CATEGORY_GAMING, "Call_of_Duty_TCP", 10, /* Weak rule */ match_cod_waw }; void register_cod_waw(LPIModuleMap *mod_map) { register_protocol(&lpi_cod_waw, mod_map); } ================================================ FILE: lib/tcp/lpi_conquer.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_conquer(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->payload_len[0] == 5 && data->payload_len[1] == 4 && MATCH(data->payload[0], 'R', 'E', 'A', 'D')) return true; if (data->payload_len[1] == 5 && data->payload_len[0] == 4 && MATCH(data->payload[1], 'R', 'E', 'A', 'D')) return true; if (data->payload_len[0] == 4 && (MATCH(data->payload[0], '5', '0', ANY, ANY) || MATCH(data->payload[0], '5', '1', ANY, ANY)) && MATCH(data->payload[1], 'U', 'P', 'D', 'A')) return true; if (data->payload_len[1] == 4 && (MATCH(data->payload[1], '5', '0', ANY, ANY) || MATCH(data->payload[1], '5', '1', ANY, ANY)) && MATCH(data->payload[0], 'U', 'P', 'D', 'A')) return true; return false; } static lpi_module_t lpi_conquer = { LPI_PROTO_CONQUER, LPI_CATEGORY_GAMING, "ConquerOnline", 3, match_conquer }; void register_conquer(LPIModuleMap *mod_map) { register_protocol(&lpi_conquer, mod_map); } ================================================ FILE: lib/tcp/lpi_crashplan.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_crashplan_16(uint32_t payload, uint32_t len) { if (len != 16) return false; return true; } static inline bool match_crashplan_6(uint32_t payload, uint32_t len) { if (len != 6) return false; if (!MATCH(payload, 0x80, 0x63, 0x00, 0x00)) return false; return true; } static inline bool match_crashplan(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_crashplan_16(data->payload[0], data->payload_len[0])) { if (match_crashplan_6(data->payload[1], data->payload_len[1])) return true; } if (match_crashplan_16(data->payload[1], data->payload_len[1])) { if (match_crashplan_6(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_crashplan = { LPI_PROTO_CRASHPLAN, LPI_CATEGORY_CLOUD, "CrashPlan", 50, match_crashplan }; void register_crashplan(LPIModuleMap *mod_map) { register_protocol(&lpi_crashplan, mod_map); } ================================================ FILE: lib/tcp/lpi_crossfire_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_cf_05(uint32_t payload, uint32_t len) { if (len == 65 && MATCH(payload, 0x05, 0x01, 0x99, 0x01)) return true; return false; } static inline bool match_cf_tcp(uint32_t payload, uint32_t len) { uint32_t hlen = bswap_le_to_host32(payload & 0xffff00) >> 8; if (len < 1350 && hlen != len - 7) return false; if (MATCH(payload, 0xf1, ANY, ANY, 0x01)) return true; if (MATCH(payload, 0xf1, ANY, ANY, 0x00)) return true; return false; } static inline bool match_crossfire_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_cf_tcp(data->payload[0], data->payload_len[0])) { if (match_cf_tcp(data->payload[1], data->payload_len[1])) { return true; } if (match_cf_05(data->payload[1], data->payload_len[1])) { return true; } } if (match_cf_05(data->payload[0], data->payload_len[0])) { if (match_cf_tcp(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_crossfire_tcp = { LPI_PROTO_CROSSFIRE, LPI_CATEGORY_GAMING, "CrossfireTCP", 30, match_crossfire_tcp }; void register_crossfire_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_crossfire_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_cryptic.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Cryptic are the company behind several popular MMOs, including * Champions Online and Star Trek Online */ static inline bool match_cryptic(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "Cryp", "Cryp")) return true; return false; } static lpi_module_t lpi_cryptic = { LPI_PROTO_CRYPTIC, LPI_CATEGORY_GAMING, "Cryptic", 2, match_cryptic }; void register_cryptic(LPIModuleMap *mod_map) { register_protocol(&lpi_cryptic, mod_map); } ================================================ FILE: lib/tcp/lpi_cvs.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_cvs_request(uint32_t data, uint32_t len) { if (MATCHSTR(data, "BEGI")) return true; return false; } static inline bool match_cvs_response(uint32_t data, uint32_t len) { if (len == 0) return true; /* "I LOVE YOU" = auth succeeded */ if (MATCHSTR(data, "I LO")) return true; /* "I HATE YOU" = auth failed */ if (MATCHSTR(data, "I HA")) return true; /* "E " = a message */ if (MATCH(data, 'E', ' ', ANY, ANY)) return true; /* error = an error */ if (MATCHSTR(data, "erro")) return true; return false; } static inline bool match_cvs(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_cvs_request(data->payload[0], data->payload_len[0]) && match_cvs_response(data->payload[1], data->payload_len[1])) return true; if (match_cvs_request(data->payload[1], data->payload_len[1]) && match_cvs_response(data->payload[0], data->payload_len[0])) return true; return false; } static lpi_module_t lpi_cvs = { LPI_PROTO_CVS, LPI_CATEGORY_RCS, "CVS", 3, match_cvs }; void register_cvs(LPIModuleMap *mod_map) { register_protocol(&lpi_cvs, mod_map); } ================================================ FILE: lib/tcp/lpi_dahua_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Chinese IP surveillance Cameras */ static inline bool match_dahua_ports(uint16_t sport, uint16_t cport) { if (sport == 8888 || cport == 8888) { return true; } if (sport == 37777 || cport == 37777) { return true; } return false; } static inline bool match_f4_186(uint32_t payload, uint32_t len) { if (len == 186 && MATCH(payload, 0xf4, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_f4_208(uint32_t payload, uint32_t len) { if (len >= 206 && len <= 208 && MATCH(payload, 0xf4, 0x00, 0x00, 0x58)) return true; return false; } static inline bool match_dahua(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_dahua_ports(data->server_port, data->client_port)) { return false; } if (match_f4_186(data->payload[0], data->payload_len[0])) { if (match_f4_208(data->payload[1], data->payload_len[1])) { return true; } } if (match_f4_186(data->payload[1], data->payload_len[1])) { if (match_f4_208(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_dahua_tcp = { LPI_PROTO_DAHUA, LPI_CATEGORY_IPCAMERAS, "DahuaTCP", 13, match_dahua }; void register_dahua_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_dahua_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_dash.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_dash_125(uint32_t payload, uint32_t len) { if (len == 125 && MATCH(payload, 0xbf, 0x0c, 0x6b, 0xbd)) return true; return false; } static inline bool match_dash_130(uint32_t payload, uint32_t len) { if (len == 130 && MATCH(payload, 0xbf, 0x0c, 0x6b, 0xbd)) return true; return false; } static inline bool match_dash(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 9999 */ if (match_dash_125(data->payload[0], data->payload_len[0])) { if (match_dash_130(data->payload[1], data->payload_len[1])) return true; } if (match_dash_125(data->payload[1], data->payload_len[1])) { if (match_dash_130(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_dash = { LPI_PROTO_DASH, LPI_CATEGORY_ECOMMERCE, "Dash", 5, match_dash }; void register_dash(LPIModuleMap *mod_map) { register_protocol(&lpi_dash, mod_map); } ================================================ FILE: lib/tcp/lpi_dell_backup.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* This one is a bit tenuous but I'm reasonably confident that this is * something to do with the Dell backup and recovery service. All observed * traffic matching the rules described here go 66.151.242.0/24, which has * previously reversed to dellbackupandrecoverycloudstorage.com. */ static inline bool match_dell_backup_req(uint32_t payload, uint32_t len) { if (len != 12) return false; if (MATCH(payload, 0x08, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_dell_backup_resp(uint32_t payload, uint32_t len) { if (len != 24) return false; if (MATCH(payload, 0x14, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_dell_backup(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 443 && data->client_port != 443) return false; if (match_dell_backup_req(data->payload[0], data->payload_len[0])) { if (match_dell_backup_resp(data->payload[1], data->payload_len[1])) return true; } if (match_dell_backup_req(data->payload[1], data->payload_len[1])) { if (match_dell_backup_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_dell_backup = { LPI_PROTO_DELL_BACKUP, LPI_CATEGORY_CLOUD, "DellBackup", 100, match_dell_backup }; void register_dell_backup(LPIModuleMap *mod_map) { register_protocol(&lpi_dell_backup, mod_map); } ================================================ FILE: lib/tcp/lpi_destiny.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Destiny -- multiplayer FPS by Bungie */ static inline bool match_destiny_request(uint32_t payload, uint32_t len) { if (len == 140 && MATCH(payload, 0x01, 0x02, 0x00, 0x00)) return true; return false; } static inline bool match_destiny_reply(uint32_t payload, uint32_t len) { if (len == 142 && MATCH(payload, 0x01, 0x02, 0x00, 0x00)) return true; return false; } static inline bool match_destiny(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_destiny_request(data->payload[0], data->payload_len[0])) { if (match_destiny_reply(data->payload[1], data->payload_len[1])) return true; } if (match_destiny_request(data->payload[1], data->payload_len[1])) { if (match_destiny_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_destiny = { LPI_PROTO_DESTINY, LPI_CATEGORY_GAMING, "Destiny", 23, match_destiny }; void register_destiny(LPIModuleMap *mod_map) { register_protocol(&lpi_destiny, mod_map); } ================================================ FILE: lib/tcp/lpi_diablo3.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_diablo_req(uint32_t payload, uint32_t len) { if (len == 25 && MATCH(payload, 0x00, 0x00, 0x00, 0x19)) return true; return false; } static inline bool match_diablo_resp(uint32_t payload, uint32_t len) { if (len == 66 && MATCH(payload, 0x00, 0x00, 0x00, 0x42)) return true; return false; } static inline bool match_diablo3(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_diablo_req(data->payload[0], data->payload_len[0])) { if (match_diablo_resp(data->payload[1], data->payload_len[1])) return true; } if (match_diablo_req(data->payload[1], data->payload_len[1])) { if (match_diablo_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_diablo3 = { LPI_PROTO_DIABLO3, LPI_CATEGORY_GAMING, "Diablo3", 5, match_diablo3 }; void register_diablo3(LPIModuleMap *mod_map) { register_protocol(&lpi_diablo3, mod_map); } ================================================ FILE: lib/tcp/lpi_dianping_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_dianping_query(uint32_t payload, uint32_t len) { if (len != 1) return false; if (MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; if (MATCH(payload, 0x01, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_dianping_resp(uint32_t payload, uint32_t len) { if (len != 1) return false; if (MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_dianping_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 80 && data->client_port != 80 && data->client_port != 443 && data->server_port != 443) return false; if (match_dianping_query(data->payload[0], data->payload_len[0])) { if (match_dianping_resp(data->payload[1], data->payload_len[1])) return true; } if (match_dianping_query(data->payload[1], data->payload_len[1])) { if (match_dianping_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_dianping_tcp = { LPI_PROTO_DIANPING, LPI_CATEGORY_MOBILE_APP, "DianpingTCP", 210, match_dianping_tcp }; void register_dianping_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_dianping_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_directconnect.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_dc(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* $MyN seemed best to check for - might have to check for $max and * $Sup as well */ /* NOTE: Some people seem to use DC to connect to port 80 and get * HTTP responses. At this stage, I'd rather that fell under DC rather * than HTTP, so we need to check for this before we check for HTTP */ if (match_str_either(data, "$MyN")) return true; if (match_str_either(data, "$Sup")) return true; if (match_str_either(data, "$Loc")) return true; /* Response is usually an HTTP response - we could check that if * needed */ return false; } static lpi_module_t lpi_directconnect = { LPI_PROTO_DC, LPI_CATEGORY_P2P, "DirectConnect", 1, /* Need a higher priority than regular HTTP */ match_dc }; void register_directconnect(LPIModuleMap *mod_map) { register_protocol(&lpi_directconnect, mod_map); } ================================================ FILE: lib/tcp/lpi_dnf.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_dnf_90(uint32_t payload, uint32_t len) { if (len == 90 && MATCH(payload, 0x01, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_dnf_258(uint32_t payload, uint32_t len) { if (len == 258 && MATCH(payload, 0x01, 0x00, 0x00, 0x01)) return true; return false; } static inline bool match_dnf(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 80 or 443 */ if (match_dnf_90(data->payload[0], data->payload_len[0])) { if (match_dnf_258(data->payload[1], data->payload_len[1])) return true; } if (match_dnf_90(data->payload[1], data->payload_len[1])) { if (match_dnf_258(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_dnf = { LPI_PROTO_DNF, LPI_CATEGORY_GAMING, "DNF", 150, match_dnf }; void register_dnf(LPIModuleMap *mod_map) { register_protocol(&lpi_dnf, mod_map); } ================================================ FILE: lib/tcp/lpi_dns.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static bool match_length_single(uint32_t payload, uint32_t len) { uint32_t statedlen; if (len == 2) { return true; } statedlen = (ntohl(payload) >> 16); if (statedlen < 1280) { if (statedlen != len - 2) return false; } return true; } static bool match_dns_tcp_length(lpi_data_t *data) { uint32_t id0, id1; if (data->payload_len[0] == 0 || data->payload_len[1] == 0) return false; if (data->server_port != 53 && data->client_port != 53) return false; if (!match_length_single(data->payload[0], data->payload_len[0])) return false; if (!match_length_single(data->payload[1], data->payload_len[1])) return false; if (data->payload_len[0] > 2 && data->payload_len[1] > 2) { id0 = (ntohl(data->payload[0]) & 0xffff); id1 = (ntohl(data->payload[1]) & 0xffff); if (id0 != id1) return false; } return true; } static bool match_tcp_dns(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_dns(data)) return true; if (match_dns_tcp_length(data)) return true; return false; } static lpi_module_t lpi_dns = { LPI_PROTO_DNS, LPI_CATEGORY_SERVICES, "DNS_TCP", 6, /* Not a high certainty */ match_tcp_dns }; void register_dns_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_dns, mod_map); } ================================================ FILE: lib/tcp/lpi_dogecoin.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_dc_magic(uint32_t payload, uint32_t len) { if (MATCH(payload, 0xc0, 0xc0, 0xc0, 0xc0)) { if (len >= 125 && len <= 129) return true; if (len == 142) return true; } return false; } static inline bool match_dogecoin(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port == 22556 */ if (match_dc_magic(data->payload[0], data->payload_len[0])) { if (match_dc_magic(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_dogecoin = { LPI_PROTO_DOGECOIN, LPI_CATEGORY_ECOMMERCE, "Dogecoin", 8, match_dogecoin }; void register_dogecoin(LPIModuleMap *mod_map) { register_protocol(&lpi_dogecoin, mod_map); } ================================================ FILE: lib/tcp/lpi_douyu.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* This is a classic 4-byte length protocol, but there is plenty of * scope for the packet sizes to vary a bit so we can't just look for * a specific combo of packet sizes */ static inline bool match_douyu_req(uint32_t payload, uint32_t len) { uint32_t plen = bswap_le_to_host32(payload); /* Packet usually contains a username and a password so * can probably vary quite a bit in size */ if (plen == len - 4) { if (len <= 255) return true; } return false; } static inline bool match_douyu_reply(uint32_t payload, uint32_t len) { uint32_t plen = bswap_le_to_host32(payload); /* Response packets seem like they will vary a lot less in * size -- could be wrong though */ if (plen == len - 4) { if (len >= 225 && len <= 255) return true; } return false; } static inline bool match_douyu_port(uint16_t port) { /* Based purely on observed flows, rather than any docs */ if (port >= 8601 && port <= 8605) return true; if (port >= 12601 && port <= 12605) return true; return false; } static inline bool match_douyu(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Tends to use a couple of different port ranges */ if (!match_douyu_port(data->server_port) && !match_douyu_port(data->client_port)) { return false; } if (match_douyu_req(data->payload[0], data->payload_len[0])) { if (match_douyu_reply(data->payload[1], data->payload_len[1])) return true; } if (match_douyu_req(data->payload[1], data->payload_len[1])) { if (match_douyu_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_douyu = { LPI_PROTO_DOUYU, LPI_CATEGORY_STREAMING, "Douyu", 249, match_douyu }; void register_douyu(LPIModuleMap *mod_map) { register_protocol(&lpi_douyu, mod_map); } ================================================ FILE: lib/tcp/lpi_douyu_chat.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_douyu_ee(uint32_t payload, uint32_t len) { if (len == 242 && MATCH(payload, 0xee, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_douyu_len(uint32_t payload, uint32_t len) { if (bswap_host_to_le32(payload) == len - 4) return true; return false; } static inline bool match_douyu_chat(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 8601 && data->client_port != 8601 && data->client_port != 8602 && data->server_port != 8602) { return false; } if (match_douyu_ee(data->payload[0], data->payload_len[0])) { if (match_douyu_len(data->payload[1], data->payload_len[1])) return true; } if (match_douyu_ee(data->payload[1], data->payload_len[1])) { if (match_douyu_len(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_douyu_chat = { LPI_PROTO_DOUYU_CHAT, LPI_CATEGORY_CHAT, "DouyuChat", 133, match_douyu_chat }; void register_douyu_chat(LPIModuleMap *mod_map) { register_protocol(&lpi_douyu_chat, mod_map); } ================================================ FILE: lib/tcp/lpi_duelingnetwork.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_duelingnetwork(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 1235 && data->client_port != 1235) return false; if (data->payload_len[0] == 40 && MATCHSTR(data->payload[0], "Ritv")) return true; if (data->payload_len[1] == 40 && MATCHSTR(data->payload[1], "Ritv")) return true; return false; } static lpi_module_t lpi_duelingnetwork = { LPI_PROTO_DUELING_NETWORK, LPI_CATEGORY_GAMING, "DuelingNetwork", 4, match_duelingnetwork }; void register_duelingnetwork(LPIModuleMap *mod_map) { register_protocol(&lpi_duelingnetwork, mod_map); } ================================================ FILE: lib/tcp/lpi_dvrns.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_dvrns_typea(uint32_t payload_a, uint32_t len_a, uint32_t payload_b, uint32_t len_b) { if (!MATCH(payload_a, 0x12, 0xa4, 0x00, 0x01)) return false; if (len_a != 188) return false; if (len_b == 0) return true; if (len_b != 20) return false; if (!MATCH(payload_b, 0x12, 0xa4, 0x00, 0x01)) return false; return true; } static inline bool match_dvrns_typeb(uint32_t payload_a, uint32_t len_a, uint32_t payload_b, uint32_t len_b) { if (!MATCH(payload_a, 0x12, 0xa4, 0x00, 0x01)) return false; if (len_a != 12) return false; if (len_b == 0) return true; if (len_b != 140) return false; if (!MATCH(payload_b, 0x12, 0xa4, 0x00, 0x01)) return false; return true; } static inline bool match_dvrns(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* DVRNS is basically DNS for DVR surveillance systems */ /* Not sure whether this is just the protocol used by dvrnames.net * or all DVRNS systems */ if (match_dvrns_typea(data->payload[0], data->payload_len[0], data->payload[1], data->payload_len[1])) return true; if (match_dvrns_typea(data->payload[1], data->payload_len[1], data->payload[0], data->payload_len[0])) return true; if (match_dvrns_typeb(data->payload[0], data->payload_len[0], data->payload[1], data->payload_len[1])) return true; if (match_dvrns_typeb(data->payload[1], data->payload_len[1], data->payload[0], data->payload_len[0])) return true; return false; } static lpi_module_t lpi_dvrns = { LPI_PROTO_DVRNS, LPI_CATEGORY_SERVICES, "DVRNS", 10, match_dvrns }; void register_dvrns(LPIModuleMap *mod_map) { register_protocol(&lpi_dvrns, mod_map); } ================================================ FILE: lib/tcp/lpi_dxp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_dxp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_chars_either(data, 0xb0, 0x04, 0x15, 0x00)) return true; return false; } static lpi_module_t lpi_dxp = { LPI_PROTO_DXP, LPI_CATEGORY_DATABASES, "Silverplatter_DXP", 3, match_dxp }; void register_dxp(LPIModuleMap *mod_map) { register_protocol(&lpi_dxp, mod_map); } ================================================ FILE: lib/tcp/lpi_ea_games.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ea_games(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Not sure exactly what game this is, but the server matches the * EA IP range and the default port is 9946 */ if (match_str_both(data, "&lgr", "&lgr")) return true; if (match_str_either(data, "&lgr")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } return false; } static lpi_module_t lpi_ea_games = { LPI_PROTO_EA_GAMES, LPI_CATEGORY_GAMING, "EA_Games", 4, match_ea_games }; void register_ea_games(LPIModuleMap *mod_map) { register_protocol(&lpi_ea_games, mod_map); } ================================================ FILE: lib/tcp/lpi_emule.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_emule_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_emule(data)) return true; return false; } static lpi_module_t lpi_emule = { LPI_PROTO_EMULE, LPI_CATEGORY_P2P, "EMule", 10, /* We've always had this at low priority */ match_emule_tcp }; void register_emule(LPIModuleMap *mod_map) { register_protocol(&lpi_emule, mod_map); } ================================================ FILE: lib/tcp/lpi_ethernetip.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_command(uint32_t payload) { // no op if (MATCH(payload, 0x00, 0x00, ANY, ANY)) return true; // list services if (MATCH(payload, 0x04, 0x00, ANY, ANY)) return true; // list identity if (MATCH(payload, 0x63, 0x00, ANY, ANY)) return true; // list interfaces if (MATCH(payload, 0x64, 0x00, ANY, ANY)) return true; // register session if (MATCH(payload, 0x65, 0x00, 0x04, 0x00)) return true; // un-register session if (MATCH(payload, 0x66, 0x00, ANY, ANY)) return true; // sendrrdata if (MATCH(payload, 0x6f, 0x00, ANY, ANY)) return true; // send unit data if (MATCH(payload, 0x70, 0x00, ANY, ANY)) return true; // indicate status if (MATCH(payload, 0x72, 0x00, ANY, ANY)) return true; // cancel if (MATCH(payload, 0x73, 0x00, ANY, ANY)) return true; // error if (MATCH(payload, 0xff, 0xff, ANY, ANY)) return true; return false; } static inline bool match_ethernetip(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->payload_len[0] < 24 || data->payload_len[1] < 24) return false; if (data->server_port != 44818 && data->client_port != 44818) return false; if (match_command(data->payload[0]) && match_command(data->payload[1])) return true; return false; } static lpi_module_t lpi_ethernetip = { LPI_PROTO_ETHERNETIP, LPI_CATEGORY_ICS, "EtherNet/IP", 100, match_ethernetip }; void register_ethernetip(LPIModuleMap *mod_map) { register_protocol(&lpi_ethernetip, mod_map); } ================================================ FILE: lib/tcp/lpi_eye.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* All-seeing Eye - Yahoo Games */ static inline bool match_eye(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "EYE1")) return true; return false; } static lpi_module_t lpi_eye = { LPI_PROTO_EYE, LPI_CATEGORY_GAMING, "AllSeeingEye", 3, match_eye }; void register_eye(LPIModuleMap *mod_map) { register_protocol(&lpi_eye, mod_map); } ================================================ FILE: lib/tcp/lpi_facebook_turn.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_fbturn_request(uint32_t payload, uint32_t len) { /* 0x74 == len - 2, 0x0001 == binding request */ if (len == 118 && MATCH(payload, 0x00, 0x74, 0x00, 0x01)) return true; if (len == 114 && MATCH(payload, 0x00, 0x70, 0x00, 0x01)) return true; if (len == 110 && MATCH(payload, 0x00, 0x6c, 0x00, 0x01)) return true; if (len == 122 && MATCH(payload, 0x00, 0x78, 0x00, 0x01)) return true; if (len == 126 && MATCH(payload, 0x00, 0x7c, 0x00, 0x01)) return true; return false; } static inline bool match_fbturn_reply(uint32_t payload, uint32_t len) { /* 0x40 == len - 2, 0x0101 == binding accepted */ if (len == 66 && MATCH(payload, 0x00, 0x40, 0x01, 0x01)) return true; if (len == 82 && MATCH(payload, 0x00, 0x50, 0x01, 0x01)) return true; return false; } static inline bool match_facebook_turn(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Seems to be a slightly custom version of TURN, as there is a two * byte length field preceding the conventional STUN header. Can't * find any explanation for this in RFC 5766, so maybe it is a Facebook * addition? */ if (data->server_port != 443 && data->client_port != 443) return false; if (match_fbturn_request(data->payload[0], data->payload_len[0])) { if (match_fbturn_reply(data->payload[1], data->payload_len[1])) return true; } if (match_fbturn_request(data->payload[1], data->payload_len[1])) { if (match_fbturn_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_facebook_turn = { LPI_PROTO_FACEBOOK_TURN, LPI_CATEGORY_NAT, "FacebookTURN", 55, match_facebook_turn }; void register_facebook_turn(LPIModuleMap *mod_map) { register_protocol(&lpi_facebook_turn, mod_map); } ================================================ FILE: lib/tcp/lpi_fb_message.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Observed while using Facebook Messenger -- I used the unofficial desktop * version (https://messengerfordesktop.com/) to talk to another account * logged into a web browser. I suspect direct app->app voice/video calls * may use the protocol more heavily. */ static inline bool match_fb_msg_104(uint32_t payload, uint32_t len) { if (len == 104 && MATCH(payload, 0x01, 0x13, 0x00, 0x54)) return true; if (len == 116 && MATCH(payload, 0x01, 0x13, 0x00, 0x60)) return true; return false; } static inline bool match_fb_msg_28(uint32_t payload, uint32_t len) { if (len == 28 && MATCH(payload, 0x00, 0x03, 0x00, 0x08)) return true; if (len == 44 && MATCH(payload, 0x00, 0x03, 0x00, 0x18)) return true; return false; } static inline bool match_fb_message(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 3478 && data->client_port != 3478 && data->server_port != 443 && data->client_port != 443) return false; if (match_fb_msg_28(data->payload[0], data->payload_len[0])) { if (match_fb_msg_104(data->payload[1], data->payload_len[1])) return true; } if (match_fb_msg_28(data->payload[1], data->payload_len[1])) { if (match_fb_msg_104(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_fb_message = { LPI_PROTO_FACEBOOK_MESSENGER, LPI_CATEGORY_CHAT, "FacebookMessenger", 9, match_fb_message }; void register_fb_message(LPIModuleMap *mod_map) { register_protocol(&lpi_fb_message, mod_map); } ================================================ FILE: lib/tcp/lpi_fbcdn_ssl.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Seems to be a custom version of SSL used by the FNA servers provided * by Facebook? */ static inline bool match_normal_req(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x16, 0x03, 0x01, ANY)) return true; return false; } static inline bool match_odd_reply(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x63, 0x03, 0x01, 0x00)) return true; return false; } static inline bool match_fbcdn_ssl(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 443 */ if (match_normal_req(data->payload[0], data->payload_len[0])) { if (match_odd_reply(data->payload[1], data->payload_len[1])) return true; } if (match_normal_req(data->payload[1], data->payload_len[1])) { if (match_odd_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_fbcdn_ssl = { LPI_PROTO_FBCDN_SSL, LPI_CATEGORY_WEB, "FacebookCDNSSL", 112, match_fbcdn_ssl }; void register_fbcdn_ssl(LPIModuleMap *mod_map) { register_protocol(&lpi_fbcdn_ssl, mod_map); } ================================================ FILE: lib/tcp/lpi_ffxiv.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ff_96(uint32_t payload, uint32_t len) { /* Some flows also have a 672 byte packet */ if (len != 96 && len != 672) return false; if (MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_ff_other(uint32_t payload, uint32_t len) { if (len == 0) return false; if (len == 64 || len == 63 || len == 153 || len == 154) { if (MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; } return false; } static inline bool match_ffxiv(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_ff_96(data->payload[0], data->payload_len[0])) { if (match_ff_other(data->payload[1], data->payload_len[1])) return true; } if (match_ff_96(data->payload[1], data->payload_len[1])) { if (match_ff_other(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_ffxiv = { LPI_PROTO_FINALFANTASY_XIV, LPI_CATEGORY_GAMING, "FinalFantasy14", 55, match_ffxiv }; void register_ffxiv(LPIModuleMap *mod_map) { register_protocol(&lpi_ffxiv, mod_map); } ================================================ FILE: lib/tcp/lpi_filenori.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Filenori is the most likely candidate for this -- hard to test because * you need to pay money to download anything and probably not a good look * for me to be paying money for this kind of service... */ static inline bool match_100(uint32_t payload, uint32_t len) { if (len != 15) return false; if (MATCHSTR(payload, "100 ")) return true; return false; } static inline bool match_command(uint32_t payload, uint32_t len) { /* Probably short for START */ if ((len == 20 || len == 19) && MATCHSTR(payload, "STAR")) return true; /* DOWNLOAD ? */ if (len == 39 && MATCHSTR(payload, "DOWN")) return true; return false; } static inline bool match_filenori(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_100(data->payload[0], data->payload_len[0])) { if (match_command(data->payload[1], data->payload_len[1])) return true; } if (match_100(data->payload[1], data->payload_len[1])) { if (match_command(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_filenori = { LPI_PROTO_FILENORI, LPI_CATEGORY_P2P, "Filenori", 15, match_filenori }; void register_filenori(LPIModuleMap *mod_map) { register_protocol(&lpi_filenori, mod_map); } ================================================ FILE: lib/tcp/lpi_flash.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_flash(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Flash player stuff - cross-domain policy etc. */ if (match_str_either(data, "payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } if (match_str_either(data, ". * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Bytes 3 and 4 are a length field */ static inline bool match_fliggy_req(uint32_t payload, uint32_t len) { uint32_t hlen = ntohl(payload) & 0xffff; if (MATCH(payload, 0xd1, 0x00, ANY, ANY) || MATCH(payload, 0xd5, 0x00, ANY, ANY)) { if (hlen == len - 4) return true; /* Try to account for messages that are longer than one MTU */ if (len >= 1300 && hlen > len) return true; } if (MATCH(payload, 0xd5, 0x00, 0x01, 0x16) && len >= 282) { return true; } return false; } static inline bool match_fliggy_resp(uint32_t payload, uint32_t len) { /* Usually, but not always 174 bytes -- I'm guessing sometimes * messages get merged? */ if (MATCH(payload, 0xd3, 0x00, 0x00, 0xaa) && len >= 174) return true; /* Same for this one, usually 58 but not always */ if (MATCH(payload, 0xd3, 0x00, 0x00, 0x36) && len >= 58) return true; return false; } static inline bool match_fliggy(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Ports 80 and 443, typically */ if (match_fliggy_req(data->payload[0], data->payload_len[0])) { if (match_fliggy_resp(data->payload[1], data->payload_len[1])) return true; } if (match_fliggy_req(data->payload[1], data->payload_len[1])) { if (match_fliggy_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_fliggy = { LPI_PROTO_FLIGGY, LPI_CATEGORY_ECOMMERCE, "Fliggy", 30, match_fliggy }; void register_fliggy(LPIModuleMap *mod_map) { register_protocol(&lpi_fliggy, mod_map); } ================================================ FILE: lib/tcp/lpi_fring.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_fring(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "NOPC", "1234")) return true; return false; } static lpi_module_t lpi_fring = { LPI_PROTO_FRING, LPI_CATEGORY_VOIP, "Fring", 2, match_fring }; void register_fring(LPIModuleMap *mod_map) { register_protocol(&lpi_fring, mod_map); } ================================================ FILE: lib/tcp/lpi_ftpcontrol.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ftp_reply_code(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCHSTR(payload, "220 ")) return true; if (MATCHSTR(payload, "220-")) return true; return false; } static inline bool match_ftp_command(uint32_t payload, uint32_t len) { if (len == 0) return true; /* There are lots of valid FTP commands, but let's just limit this * to ones we've observed for now */ if (MATCHSTR(payload, "USER")) return true; if (MATCHSTR(payload, "QUIT")) return true; if (MATCHSTR(payload, "FEAT")) return true; if (MATCHSTR(payload, "HELP")) return true; if (MATCHSTR(payload, "user")) return true; if (MATCHSTR(payload, "AUTH")) return true; /* This is invalid syntax, but clients using HOST seem to revert to * sane FTP commands once the server reports a syntax error */ if (MATCHSTR(payload, "HOST")) return true; return false; } static inline bool match_ftp_control(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Rule out SMTP which uses similar reply codes and commands */ if (data->server_port == 25 || data->client_port == 25) return false; if (match_ftp_reply_code(data->payload[0], data->payload_len[0])) { if (match_ftp_command(data->payload[1], data->payload_len[1])) return true; } if (match_ftp_reply_code(data->payload[1], data->payload_len[1])) { if (match_ftp_command(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_ftpcontrol = { LPI_PROTO_FTP_CONTROL, LPI_CATEGORY_FILES, "FTP_Control", 3, match_ftp_control }; void register_ftpcontrol(LPIModuleMap *mod_map) { register_protocol(&lpi_ftpcontrol, mod_map); } ================================================ FILE: lib/tcp/lpi_ftpdata.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_bulk_response(uint32_t payload, uint32_t len) { /* Most FTP-style transactions result in no packets being sent back * to server (aside from ACKs) */ if (len == 0) return true; /* However, there is at least one FTP client that sends some sort of * sequence number back to the server - maybe allowing for resumption * of paused transfers? * * XXX This seems to be related to completely failing to implement the * FTP protocol correctly. There is usually a flow preceding these * flows that sends commands like "get" and "dir" to the server, * which are not actually part of the FTP protocol. Instead, these * are often commands typed into FTP CLI clients that are converted * into the appropriate FTP commands. No idea what software is doing * this, but it is essentially emulating FTP so I'll keep it in here * for now. * */ if (len == 4 && MATCH(payload, 0x00, 0x00, ANY, ANY)) return true; /* Another weird FTP client: sends the occasional one byte response */ if (len == 1 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } /* Bulk download covers files being downloaded through a separate channel, * like FTP data. We identify these by observing file type identifiers at the * start of the packet. This is not a protocol in itself, but it's almost * certainly FTP. */ static inline bool match_bulk_download(lpi_data_t *data) { if (match_bulk_response(data->payload[1], data->payload_len[1]) && match_file_header(data->payload[0])) return true; if (match_bulk_response(data->payload[0], data->payload_len[0]) && match_file_header(data->payload[1])) return true; return false; } static inline bool match_directory(lpi_data_t *data) { /* FTP Data can start with directory permissions */ if ( (MATCH(data->payload[0], '-', ANY, ANY, ANY) || MATCH(data->payload[0], 'd', ANY, ANY, ANY)) && (MATCH(data->payload[0], ANY, '-', ANY, ANY) || MATCH(data->payload[0], ANY, 'r', ANY, ANY)) && (MATCH(data->payload[0], ANY, ANY, '-', ANY) || MATCH(data->payload[0], ANY, ANY, 'w', ANY)) && (MATCH(data->payload[0], ANY, ANY, ANY, '-') || MATCH(data->payload[0], ANY, ANY, ANY, 'x')) ) return true; if ( (MATCH(data->payload[1], '-', ANY, ANY, ANY) || MATCH(data->payload[1], 'd', ANY, ANY, ANY)) && (MATCH(data->payload[1], ANY, '-', ANY, ANY) || MATCH(data->payload[1], ANY, 'r', ANY, ANY)) && (MATCH(data->payload[1], ANY, ANY, '-', ANY) || MATCH(data->payload[1], ANY, ANY, 'w', ANY)) && (MATCH(data->payload[1], ANY, ANY, ANY, '-') || MATCH(data->payload[1], ANY, ANY, ANY, 'x')) ) return true; return false; } static inline bool match_ftp_data(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_bulk_download(data)) return true; /* XXX All rules below this are for one-way exchanges only */ if (data->payload_len[0] > 0 && data->payload_len[1] > 0) return false; if (match_directory(data)) return true; /* Virus definition updates from CA are delivered via FTP */ if (match_str_either(data, "Viru")) return true; /* XXX - I hate having to look at port numbers but there are no * useful headers in FTP data exchanges; all the FTP protocol stuff * is done using the control channel */ if (data->client_port == 20 || data->server_port == 20) return true; return false; } static lpi_module_t lpi_ftpdata = { LPI_PROTO_FTP_DATA, LPI_CATEGORY_FILES, "FTP_Data", 7, /* Some of these rules rely on port numbers and one-way data, so * should have a lower priority than more concrete rules */ match_ftp_data }; void register_ftpdata(LPIModuleMap *mod_map) { register_protocol(&lpi_ftpdata, mod_map); } ================================================ FILE: lib/tcp/lpi_fuckcoin.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_fc_magic(uint32_t payload, uint32_t len) { if (MATCH(payload, 0xfb, 0xc0, 0xb6, 0xdb)) { if (len == 126) return true; if (len == 146) return true; } return false; } static inline bool match_fuckcoin(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port == 9333 */ if (match_fc_magic(data->payload[0], data->payload_len[0])) { if (match_fc_magic(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_fuckcoin = { LPI_PROTO_FUCKCOIN, LPI_CATEGORY_ECOMMERCE, "Dogecoin", 8, match_fuckcoin }; void register_fuckcoin(LPIModuleMap *mod_map) { register_protocol(&lpi_fuckcoin, mod_map); } ================================================ FILE: lib/tcp/lpi_funshion.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" #include /* Funshion is a Chinese P2PTV application that seems to use a bunch * of different protocols / messages. */ static inline bool match_funshion_54(uint32_t payload, uint32_t len) { if (len != 54) return false; /* Byte 4 is always 0x00. * Byte 3 is always 0x?1, where '?' can be any hex digit. */ if ((payload & 0xff0f0000) == 0x00010000) return true; return false; } static inline bool match_funshion_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Only ever observed this traffic pattern on port 6601 */ if (data->server_port == 6601 || data->client_port == 6601) { if (match_funshion_54(data->payload[0], data->payload_len[0])) { if (match_funshion_54(data->payload[1], data->payload_len[1])) return true; } } return false; } static lpi_module_t lpi_funshion_tcp = { LPI_PROTO_FUNSHION, LPI_CATEGORY_P2PTV, "Funshion_TCP", 10, match_funshion_tcp }; void register_funshion_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_funshion_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_gamespy.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_gamespy_bsr(uint32_t payload, uint32_t len) { if (len != 16) return false; if (!MATCH(payload, 0x5c, 'b', 's', 'r')) return false; return true; } static inline bool match_gamespy_search(uint32_t payload, uint32_t len) { if (!MATCH(payload, 0x5c, 's', 'e', 'a')) return false; return true; } static inline bool match_gamespy_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_gamespy_bsr(data->payload[0], data->payload_len[0])) { if (match_gamespy_search(data->payload[1], data->payload_len[1])) return true; } if (match_gamespy_bsr(data->payload[1], data->payload_len[1])) { if (match_gamespy_search(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_gamespy_tcp = { LPI_PROTO_GAMESPY, LPI_CATEGORY_GAMING, "Gamespy_TCP", 6, match_gamespy_tcp }; void register_gamespy_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_gamespy_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_gcafe_updater.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_caf(uint32_t payload, uint32_t len) { if (len == 53 && MATCH(payload, 0x0c, 'C', 'A', 'F')) return true; return false; } static inline bool match_gcafe_updater(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Seen on ports 16800 and 1839 */ if (match_caf(data->payload[0], data->payload_len[0])) { if (match_caf(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_gcafe_updater = { LPI_PROTO_GCAFE_UPDATER, LPI_CATEGORY_P2P, "G-CafeUpdater", 11, match_gcafe_updater }; void register_gcafe_updater(LPIModuleMap *mod_map) { register_protocol(&lpi_gcafe_updater, mod_map); } ================================================ FILE: lib/tcp/lpi_giop.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_giop(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (MATCH(data->payload[0], 'G', 'I', 'O', 'P')) { if (MATCH(data->payload[1], 'G', 'I', 'O', 'P')) return true; if (data->payload_len[1] == 0) return true; } if (MATCH(data->payload[1], 'G', 'I', 'O', 'P')) { if (data->payload_len[0] == 0) return true; } return false; } static lpi_module_t lpi_giop = { LPI_PROTO_GIOP, LPI_CATEGORY_REMOTE, "GIOP", 5, match_giop }; void register_giop(LPIModuleMap *mod_map) { register_protocol(&lpi_giop, mod_map); } ================================================ FILE: lib/tcp/lpi_git.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_git_header(uint32_t payload, uint32_t len) { int i; char headerstr[4]; uint8_t *pl = (uint8_t *)(&payload); if (len == 0) return true; memset(headerstr, 0, 4); for (i = 0; i < 4; i++) { headerstr[i] = (char)(*pl); pl++; } uint32_t replen = strtoul(headerstr, NULL, 16); if (replen != len) return false; return true; } static inline bool match_git(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_git_header(data->payload[0], data->payload_len[0])) { if (match_git_header(data->payload[1], data->payload_len[1])) return true; } if (match_git_header(data->payload[1], data->payload_len[1])) { if (match_git_header(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_git = { LPI_PROTO_GIT, LPI_CATEGORY_RCS, "Git", 5, match_git }; void register_git(LPIModuleMap *mod_map) { register_protocol(&lpi_git, mod_map); } ================================================ FILE: lib/tcp/lpi_glupteba.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* https://www.trendmicro.com/vinfo/us/threat-encyclopedia/malware/bkdr_glupteba.yvg */ static inline bool match_glup_hello(uint32_t payload, uint32_t len) { if (MATCH(payload, 'H', 'E', 'L', 'L')) return true; return false; } static inline bool match_glup_id(uint32_t payload, uint32_t len) { /* ID changes from infected host to infected host, but I'm * going to assume the ID has a similar length. */ if (len >= 18 && len <= 25) { /* Always begins with @ */ if (MATCH(payload, '@', ANY, ANY, ANY)) return true; } return false; } static inline bool match_glupteba(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_glup_hello(data->payload[0], data->payload_len[0])) { if (match_glup_id(data->payload[1], data->payload_len[1])) { return true; } if (match_glup_hello(data->payload[1], data->payload_len[1])) { return true; } } if (match_glup_hello(data->payload[1], data->payload_len[1])) { if (match_glup_id(data->payload[0], data->payload_len[0])) { return true; } if (match_glup_hello(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_glupteba = { LPI_PROTO_GLUPTEBA, LPI_CATEGORY_MALWARE, "GluptebaBackdoor", 50, match_glupteba }; void register_glupteba(LPIModuleMap *mod_map) { register_protocol(&lpi_glupteba, mod_map); } ================================================ FILE: lib/tcp/lpi_gnutella.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_gnutella(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "GNUT")) return true; if (match_str_either(data, "GIV ")) return true; return false; } static lpi_module_t lpi_gnutella = { LPI_PROTO_GNUTELLA, LPI_CATEGORY_P2P, "Gnutella", 1, /* Avoid matching HTTP which uses similar commands */ match_gnutella }; void register_gnutella(LPIModuleMap *mod_map) { register_protocol(&lpi_gnutella, mod_map); } ================================================ FILE: lib/tcp/lpi_goku.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_goku(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "ok:g", "baut")) return true; if (match_str_both(data, "ok:w", "baut")) return true; return false; } static lpi_module_t lpi_goku = { LPI_PROTO_GOKUCHAT, LPI_CATEGORY_CHAT, "GokuChat", 3, match_goku }; void register_goku(LPIModuleMap *mod_map) { register_protocol(&lpi_goku, mod_map); } ================================================ FILE: lib/tcp/lpi_googlehangouts.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_hangout_req(uint32_t payload, uint32_t len) { if ((len % 114) == 0) { if (MATCH(payload, 0x00, 0x70, 0x00, 0x01)) return true; } if ((len % 122) == 0) { if (MATCH(payload, 0x00, 0x78, 0x00, 0x01)) return true; } if (len == 110 && MATCH(payload, 0x00, 0x6c, 0x00, 0x01)) return true; return false; } static inline bool match_hangout_resp(uint32_t payload, uint32_t len) { if (len == 106) { if (MATCH(payload, 0x00, 0x68, 0x01, 0x01)) return true; } if (len == 118) { if (MATCH(payload, 0x00, 0x74, 0x01, 0x01)) return true; } if (len == 94 && MATCH(payload, 0x00, 0x5c, 0x01, 0x01)) return true; return false; } static inline bool match_googlehangouts(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Based on traffic seen on port 19305 to google addresses */ /* Limit this to port 19305 - 19309 */ if (data->server_port < 19305 || data->server_port > 19309) { if (data->client_port < 19305 || data->client_port > 19309) return false; } if (match_hangout_req(data->payload[0], data->payload_len[0])) { if (match_hangout_resp(data->payload[1], data->payload_len[1])) return true; } if (match_hangout_req(data->payload[1], data->payload_len[1])) { if (match_hangout_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_googlehangouts = { LPI_PROTO_GOOGLE_HANGOUTS, LPI_CATEGORY_CHAT, "GoogleHangouts", 12, match_googlehangouts }; void register_googlehangouts(LPIModuleMap *mod_map) { register_protocol(&lpi_googlehangouts, mod_map); } ================================================ FILE: lib/tcp/lpi_graalonlineera.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_goe_gnp(uint32_t payload, uint32_t len) { if (len == 8 && MATCH(payload, 'G', 'N', 'P', '1')) return true; return false; } static inline bool match_goe_binary(uint32_t payload, uint32_t len) { if (len >= 275 && len <= 300) { if (MATCH(payload, 0x01, 0x02, 0x00, 0x01)) return true; if (MATCH(payload, 0x01, 0x03, 0x00, 0x01)) return true; } return false; } static inline bool match_graalonlineera(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 14900 */ if (match_goe_gnp(data->payload[0], data->payload_len[0])) { if (match_goe_binary(data->payload[1], data->payload_len[1])) return true; } if (match_goe_gnp(data->payload[1], data->payload_len[1])) { if (match_goe_binary(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_graalonlineera = { LPI_PROTO_GRAAL_ONLINE_ERA, LPI_CATEGORY_GAMING, "GraalOnlineEra", 8, match_graalonlineera }; void register_graalonlineera(LPIModuleMap *mod_map) { register_protocol(&lpi_graalonlineera, mod_map); } ================================================ FILE: lib/tcp/lpi_guildwars2.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_gw2_req(uint32_t payload, uint32_t len) { if (len < 285 || len > 295) return false; if (MATCH(payload, 0x50, 0x20, 0x2f, 0x53)) return true; return false; } static inline bool match_gw2_resp(uint32_t payload, uint32_t len) { if (len != 35) return false; if (MATCH(payload, 0x53, 0x54, 0x53, 0x2f)) return true; return false; } static inline bool match_guildwars2(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_gw2_req(data->payload[1], data->payload_len[1])) { if (match_gw2_resp(data->payload[0], data->payload_len[0])) return true; } if (match_gw2_req(data->payload[0], data->payload_len[0])) { if (match_gw2_resp(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_guildwars2 = { LPI_PROTO_GUILDWARS2, LPI_CATEGORY_GAMING, "GuildWars2", 5, match_guildwars2 }; void register_guildwars2(LPIModuleMap *mod_map) { register_protocol(&lpi_guildwars2, mod_map); } ================================================ FILE: lib/tcp/lpi_hamachi.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_hamachi(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* All Hamachi messages that I've seen begin with a 4 byte length * field. Other protocols also do this, so I also check for the * default Hamachi port (12975) */ if (!match_payload_length(data->payload[0], data->payload_len[0])) return false; if (!match_payload_length(data->payload[1], data->payload_len[1])) return false; if (data->server_port == 12975 || data->client_port == 12975) return true; return false; } static lpi_module_t lpi_hamachi = { LPI_PROTO_HAMACHI, LPI_CATEGORY_TUNNELLING, "Hamachi", 4, match_hamachi }; void register_hamachi(LPIModuleMap *mod_map) { register_protocol(&lpi_hamachi, mod_map); } ================================================ FILE: lib/tcp/lpi_harveys.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Harveys - a seemingly custom protocol used by Harveys Real * Estate to transfer photos. Common in ISP C traces */ static inline bool match_harveys(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "77;T", "47;T")) return true; if (match_str_either(data, "47;T")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } if (match_str_either(data, "77;T")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } return false; } static lpi_module_t lpi_harveys = { LPI_PROTO_HARVEYS, LPI_CATEGORY_FILES, "Harveys", 10, match_harveys }; void register_harveys(LPIModuleMap *mod_map) { register_protocol(&lpi_harveys, mod_map); } ================================================ FILE: lib/tcp/lpi_hearthstone.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_hearthstone_req(uint32_t payload, uint32_t len) { if (len == 16 && MATCH(payload, 0x10, 0x00, 0x00, 0x00)) return true; if (len == 22 && MATCH(payload, 0x10, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_hearthstone_reply(uint32_t payload) { if (MATCH(payload, 0x0f, 0x00, 0x00, 0x00)) return true; if (MATCH(payload, 0xa8, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_hearthstone(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Consider enforcing port 1119 or 3724, if we get FPs */ if (match_hearthstone_req(data->payload[0], data->payload_len[0])) { if (match_hearthstone_reply(data->payload[1])) return true; } if (match_hearthstone_req(data->payload[1], data->payload_len[1])) { if (match_hearthstone_reply(data->payload[0])) return true; } return false; } static lpi_module_t lpi_hearthstone = { LPI_PROTO_HEARTHSTONE, LPI_CATEGORY_GAMING, "Hearthstone", 5, match_hearthstone }; void register_hearthstone(LPIModuleMap *mod_map) { register_protocol(&lpi_hearthstone, mod_map); } ================================================ FILE: lib/tcp/lpi_hola.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_hola(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (MATCH(data->payload[0], 0xac, 0x2e, 0xbf, 0x5c)) { if (MATCH(data->payload[1], 0xac, 0x2e, 0xbf, 0x5c)) return true; } return false; } static lpi_module_t lpi_hola = { LPI_PROTO_HOLA, LPI_CATEGORY_TUNNELLING, "HolaVPN", 4, match_hola }; void register_hola(LPIModuleMap *mod_map) { register_protocol(&lpi_hola, mod_map); } ================================================ FILE: lib/tcp/lpi_hots_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_bau(uint32_t payload, uint32_t len) { if (len == 743 && MATCH(payload, 0x42, 0x10, 0x61, 0x75)) return true; return false; } static inline bool match_hots_7f28(uint32_t payload, uint32_t len) { uint32_t hlen; hlen = (ntohl(payload) & 0xffff) * 2 + 5; if (len == hlen && MATCH(payload, 0x7f, 0x28, ANY, ANY)) { return true; } return false; } static inline bool match_hots_4a48(uint32_t payload, uint32_t len) { if (len == 201 && MATCH(payload, 0x4a, 0x48, 0x0c, 0xae)) return true; return false; } static inline bool match_hots_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 1119 && data->client_port != 1119) { return false; } if (match_bau(data->payload[0], data->payload_len[0])) { if (match_hots_7f28(data->payload[1], data->payload_len[1])) return true; if (match_hots_4a48(data->payload[1], data->payload_len[1])) return true; } if (match_bau(data->payload[1], data->payload_len[1])) { if (match_hots_7f28(data->payload[0], data->payload_len[0])) return true; if (match_hots_4a48(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_hots_tcp = { LPI_PROTO_HOTS, LPI_CATEGORY_GAMING, "HeroesOfTheStorm_TCP", 90, match_hots_tcp }; void register_hots_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_hots_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_http.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_http_response(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len == 1 && MATCH(payload, 'H', 0x00, 0x00, 0x00)) return true; if (MATCHSTR(payload, "HTTP")) { return true; } /* UNKNOWN seems to be a valid response from some servers, e.g. * mini_httpd */ if (MATCHSTR(payload, "UNKN")) { return true; } return false; } static inline bool match_http(lpi_data_t *data, lpi_module_t *mod) { /* Need to rule out protocols using HTTP-style commands to do * exchanges. These protocols primarily use GET, rather than other * HTTP requests */ if (!valid_http_port(data)) { if (match_str_either(data, "GET ")) return false; } if (match_http_request(data->payload[0], data->payload_len[0])) { if (match_http_response(data->payload[1], data->payload_len[1])) return true; if (match_http_request(data->payload[1], data->payload_len[1])) return true; if (match_file_header(data->payload[1]) && data->payload_len[0] != 0) return true; } if (match_http_request(data->payload[1], data->payload_len[1])) { if (match_http_response(data->payload[0], data->payload_len[0])) return true; if (match_file_header(data->payload[0]) && data->payload_len[1] != 0) return true; } /* Allow responses in both directions, even if this is doesn't entirely * make sense :/ */ if (match_http_response(data->payload[0], data->payload_len[0])) { if (match_http_response(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_http = { LPI_PROTO_HTTP, LPI_CATEGORY_WEB, "HTTP", 2, match_http }; void register_http(LPIModuleMap *mod_map) { register_protocol(&lpi_http, mod_map); } ================================================ FILE: lib/tcp/lpi_http_badport.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_http_badport(lpi_data_t *data, lpi_module_t *mod) { /* For some reason, some clients send GET messages to servers on * port 443, which unsurprisingly do not respond. I'm putting this * in a separate category to avoid mixing it in with legitimate * HTTP traffic */ if (data->payload_len[0] != 0 && data->payload_len[1] != 0) return false; if (!match_str_either(data, "GET ")) return false; if (data->server_port == 443 || data->client_port == 443) return true; return false; } static lpi_module_t lpi_http_badport = { LPI_PROTO_HTTP_BADPORT, LPI_CATEGORY_WEB, "HTTP_443", 2, match_http_badport }; void register_http_badport(LPIModuleMap *mod_map) { register_protocol(&lpi_http_badport, mod_map); } ================================================ FILE: lib/tcp/lpi_http_nonstandard.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_nonstandard_http(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Must not be on a known HTTP port * * This used to be HTTP_P2P, but we found that most of this stuff was * legit HTTP - just using really weird ports. * * We might miss some HTTP-based P2P now, but it's just too hard for * us to differentiate more than this. */ if (valid_http_port(data)) return false; if (match_str_both(data, "GET ", "HTTP")) return true; if (match_str_either(data, "GET ")) { if (data->payload_len[0] == 0 || data->payload_len[1] == 0) return true; } return false; } static lpi_module_t lpi_http_nonstandard = { LPI_PROTO_NONSTANDARD_HTTP, LPI_CATEGORY_WEB, "HTTP_NonStandard", 100, match_nonstandard_http }; void register_http_nonstandard(LPIModuleMap *mod_map) { register_protocol(&lpi_http_nonstandard, mod_map); } ================================================ FILE: lib/tcp/lpi_http_tunnel.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_http_tunnel(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "CONN", "HTTP")) return true; if (MATCHSTR(data->payload[0], "CONN") && data->payload_len[1] == 0) return true; if (MATCHSTR(data->payload[1], "CONN") && data->payload_len[0] == 0) return true; return false; } static lpi_module_t lpi_http_tunnel = { LPI_PROTO_HTTP_TUNNEL, LPI_CATEGORY_TUNNELLING, "HTTP_Tunnel", 1, /* Make sure we are higher priority than HTTP */ match_http_tunnel }; void register_http_tunnel(LPIModuleMap *mod_map) { register_protocol(&lpi_http_tunnel, mod_map); } ================================================ FILE: lib/tcp/lpi_https.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_https(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_ssl(data)) return false; /* Assume all SSL traffic on port 443 is HTTPS */ if (data->server_port == 443 || data->client_port == 443) return true; /* We'll do port 80 as well, just to be safe */ if (data->server_port == 80 || data->client_port == 80) return true; return false; } static lpi_module_t lpi_https = { LPI_PROTO_HTTPS, LPI_CATEGORY_WEB, "HTTPS", 2, /* Should be higher priority than regular SSL */ match_https }; void register_https(LPIModuleMap *mod_map) { register_protocol(&lpi_https, mod_map); } ================================================ FILE: lib/tcp/lpi_ica.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ica(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Citrix ICA */ if (match_chars_either(data, 0x7f, 0x7f, 0x49, 0x43)) return true; return false; } static lpi_module_t lpi_ica = { LPI_PROTO_ICA, LPI_CATEGORY_REMOTE, "CitrixICA", 3, match_ica }; void register_ica(LPIModuleMap *mod_map) { register_protocol(&lpi_ica, mod_map); } ================================================ FILE: lib/tcp/lpi_icep.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Internet Communications Engine Protocol */ static inline bool match_icep_validate(uint32_t payload, uint32_t len) { if (len == 14 && MATCHSTR(payload, "IceP")) { return true; } return false; } static inline bool match_icep_req(uint32_t payload, uint32_t len) { if (MATCHSTR(payload, "IceP") && len >= 30) { return true; } return false; } static inline bool match_icep(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_icep_validate(data->payload[0], data->payload_len[0])) { if (match_icep_req(data->payload[1], data->payload_len[1])) { return true; } } if (match_icep_validate(data->payload[1], data->payload_len[1])) { if (match_icep_req(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_icep = { LPI_PROTO_ICEP, LPI_CATEGORY_NAT, /* unsure about this one */ "IceP", 8, match_icep }; void register_icep(LPIModuleMap *mod_map) { register_protocol(&lpi_icep, mod_map); } ================================================ FILE: lib/tcp/lpi_id.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_id(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* TODO: Starts with only digits - request matches the response */ /* 20 3a 20 55 is an ID protocol error, I think */ if (match_str_either(data, " : U")) return true; return false; } static lpi_module_t lpi_id = { LPI_PROTO_ID, LPI_CATEGORY_SERVICES, "ID_Protocol", 3, match_id }; void register_id(LPIModuleMap *mod_map) { register_protocol(&lpi_id, mod_map); } ================================================ FILE: lib/tcp/lpi_idrivesync.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_idrivesync_hello(uint32_t payload) { if (MATCH(payload, '@', 'I', 'D', 'E')) return true; return false; } static inline bool match_idrivesync(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_idrivesync_hello(data->payload[0])) { if (match_idrivesync_hello(data->payload[1])) return true; if (data->payload_len[1] == 0) return true; } if (match_idrivesync_hello(data->payload[1])) { if (data->payload_len[0] == 0) return true; } return false; } static lpi_module_t lpi_idrivesync = { LPI_PROTO_IDRIVE_SYNC, LPI_CATEGORY_CLOUD, "IDriveSync", 5, match_idrivesync }; void register_idrivesync(LPIModuleMap *mod_map) { register_protocol(&lpi_idrivesync, mod_map); } ================================================ FILE: lib/tcp/lpi_ihexin.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Stock trading app by 10jqka.com.cn (aka Flush). */ static inline bool match_ihex_magic(uint32_t payload) { if (MATCH(payload, 0xfd, 0xfd, 0xfd, 0xfd)) return true; return false; } static inline bool match_ihexin(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 9528 and 8887 */ if (match_ihex_magic(data->payload[0])) { if (match_ihex_magic(data->payload[1])) return true; } return false; } static lpi_module_t lpi_ihexin = { LPI_PROTO_IHEXIN, LPI_CATEGORY_ECOMMERCE, "IHexin", 89, match_ihexin }; void register_ihexin(LPIModuleMap *mod_map) { register_protocol(&lpi_ihexin, mod_map); } ================================================ FILE: lib/tcp/lpi_imap.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_imap(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "* OK")) return true; return false; } static lpi_module_t lpi_imap = { LPI_PROTO_IMAP, LPI_CATEGORY_MAIL, "IMAP", 2, match_imap }; void register_imap(LPIModuleMap *mod_map) { register_protocol(&lpi_imap, mod_map); } ================================================ FILE: lib/tcp/lpi_imaps.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_imaps(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_ssl(data)) return false; /* Assume all SSL traffic on port 993 is IMAPS */ if (data->server_port == 993 || data->client_port == 993) return true; return false; } static lpi_module_t lpi_imaps = { LPI_PROTO_IMAPS, LPI_CATEGORY_MAIL, "IMAPS", 2, /* Should be a higher priority than regular SSL */ match_imaps }; void register_imaps(LPIModuleMap *mod_map) { register_protocol(&lpi_imaps, mod_map); } ================================================ FILE: lib/tcp/lpi_imesh.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_imesh_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len == 2 && MATCH(payload, 0x06, 0x00, 0x00, 0x00)) return true; if (len == 10 && MATCH(payload, 0x06, 0x00, 0x04, 0x00)) return true; if (len == 6 && MATCH(payload, 0x06, 0x00, 0x04, 0x00)) return true; if (len == 12 && MATCH(payload, 0x06, 0x00, 0x06, 0x00)) return true; return false; } static inline bool match_imesh(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Credit for this rule goes to opendpi - so if they're wrong then * we're wrong! */ if (!match_imesh_payload(data->payload[0], data->payload_len[0])) return false; if (!match_imesh_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_imesh = { LPI_PROTO_IMESH, LPI_CATEGORY_P2P, "iMesh_TCP", 3, match_imesh }; void register_imesh(LPIModuleMap *mod_map) { register_protocol(&lpi_imesh, mod_map); } ================================================ FILE: lib/tcp/lpi_invalid.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_invalid(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* I'm using invalid as a category for flows where both halves of * the connection are clearly speaking different protocols, * e.g. trying to do HTTP tunnelling via an SMTP server */ /* XXX Bittorrent-related stuff is covered in * match_invalid_bittorrent() */ /* SOCKSv4 via FTP or SMTP * * The last two octets '\x00\x50' is the port number - in this case * I've hard-coded it to be 80 */ if (match_str_both(data, "220 ", "\x04\x01\x00\x50")) return true; /* SOCKSv5 via FTP or SMTP */ if (match_str_both(data, "220 ", "\x05\x01\x00\x00")) return true; /* HTTP tunnelling via FTP or SMTP */ if (match_str_both(data, "220 ", "CONN")) return true; if (match_str_both(data, "450 ", "CONN")) return true; /* Trying to send HTTP commands to FTP or SMTP servers */ if (match_str_both(data, "220 ", "GET ")) return true; if (match_str_both(data, "450 ", "GET ")) return true; /* Trying to send HTTP commands to an SVN server */ if (match_str_both(data, "( su", "GET ")) return true; /* People running an HTTP server on the MS SQL server port */ if (match_tds_request(data->payload[0], data->payload_len[0])) { if (MATCHSTR(data->payload[1], "HTTP")) return true; } if (match_tds_request(data->payload[1], data->payload_len[1])) { if (MATCHSTR(data->payload[0], "HTTP")) return true; } return false; } static lpi_module_t lpi_invalid = { LPI_PROTO_INVALID, LPI_CATEGORY_MIXED, "Invalid", 200, /* Very low priority, but not as low as mystery protos */ match_invalid }; void register_invalid(LPIModuleMap *mod_map) { register_protocol(&lpi_invalid, mod_map); } ================================================ FILE: lib/tcp/lpi_invalid_bittorrent.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_invalid_bittorrent(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This function will match anyone doing bittorrent in one * direction and *something else* in the other. * * I've broken it down into several separate conditions, just in case * we want to treat them as separate instances later on */ /* People trying to do Bittorrent to an actual HTTP server, rather than * someone peering on port 80 */ if (match_str_either(data, "HTTP") && match_chars_either(data, 0x13, 'B', 'i', 't')) return true; /* People sending GETs to a Bittorrent peer?? */ if (match_str_either(data, "GET ") && match_chars_either(data, 0x13, 'B', 'i', 't')) return true; /* We also get a bunch of cases where one end is doing bittorrent * and the other end is speaking a protocol that begins with a 4 * byte length field. */ if (match_chars_either(data, 0x13, 'B', 'i', 't')) { if (match_payload_length(data->payload[0],data->payload_len[0])) return true; if (match_payload_length(data->payload[1],data->payload_len[1])) return true; } /* This assumes we've checked for regular bittorrent prior to calling * this function! */ if (match_chars_either(data, 0x13, 'B', 'i', 't')) return true; return false; } static lpi_module_t lpi_invalid_bittorrent = { LPI_PROTO_INVALID_BT, LPI_CATEGORY_MIXED, "Invalid_Bittorrent", 200, match_invalid_bittorrent }; void register_invalid_bittorrent(LPIModuleMap *mod_map) { register_protocol(&lpi_invalid_bittorrent, mod_map); } ================================================ FILE: lib/tcp/lpi_invalid_http.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_invalid_http(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This function is for identifying web servers that are not * following the HTTP spec properly. * * For flows where the client is not doing HTTP properly, see * match_web_junk(). */ /* HTTP servers that appear to respond with raw HTML */ if (match_str_either(data, "GET ")) { if (match_chars_either(data, '<', 'H', 'T', 'M')) return true; if (match_chars_either(data, '<', 'h', 't', 'm')) return true; if (match_chars_either(data, '<', 'h', '1', '>')) return true; if (match_chars_either(data, '<', 't', 'i', 't')) return true; } return false; } static lpi_module_t lpi_invalid_http = { LPI_PROTO_INVALID_HTTP, LPI_CATEGORY_WEB, "Invalid_HTTP", 200, match_invalid_http }; void register_invalid_http(LPIModuleMap *mod_map) { register_protocol(&lpi_invalid_http, mod_map); } ================================================ FILE: lib/tcp/lpi_invalid_pop.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_invalid_pop(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This basically covers cases where idiots run SMTP servers on the * POP port, so we get SMTP responses to valid POP commands */ if (match_str_both(data, "USER", "421 ")) return true; if (match_str_both(data, "QUIT", "421 ")) return true; return false; } static lpi_module_t lpi_invalid_pop = { LPI_PROTO_INVALID_POP3, LPI_CATEGORY_MAIL, "Invalid_POP3", 200, match_invalid_pop }; void register_invalid_pop(LPIModuleMap *mod_map) { register_protocol(&lpi_invalid_pop, mod_map); } ================================================ FILE: lib/tcp/lpi_invalid_smtp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_invalid_smtp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* SMTP flows that do not conform to the spec properly */ if (match_str_both(data, "250-", "EHLO")) return true; if (match_str_both(data, "250 ", "HELO")) return true; if (match_str_both(data, "220 ", "MAIL")) return true; if (match_str_both(data, "\x00\x00\x00\x00", "EHLO")) return true; if (match_str_both(data, "\x00\x00\x00\x00", "HELO")) return true; return false; } static lpi_module_t lpi_invalid_smtp = { LPI_PROTO_INVALID_SMTP, LPI_CATEGORY_MAIL, "Invalid_SMTP", 200, match_invalid_smtp }; void register_invalid_smtp(LPIModuleMap *mod_map) { register_protocol(&lpi_invalid_smtp, mod_map); } ================================================ FILE: lib/tcp/lpi_ipfs.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* self-described "P2P hypermedia protocol" -- https://ipfs.io */ static inline bool match_ipfs_mu(uint32_t payload, uint32_t len) { if (len == 20 && MATCH(payload, 0x13, 0x2f, 'm', 'u')) { return true; } if (len == 34 && MATCH(payload, 0x13, 0x2f, 'm', 'u')) { return true; } return false; } static inline bool match_ipfs_single(uint32_t payload, uint32_t len) { if (len == 1 && MATCH(payload, 0x13, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_ipfs_length(uint32_t payload, uint32_t len) { uint32_t plen = ntohl(payload); /* Starting to see IPFS replies with a four byte length field */ if (plen + 4 == len) { return true; } return false; } static inline bool match_ipfs(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 4001 by default, but probably changeable */ if (match_ipfs_mu(data->payload[0], data->payload_len[0])) { if (match_ipfs_single(data->payload[1], data->payload_len[1])) return true; if (match_ipfs_mu(data->payload[1], data->payload_len[1])) return true; if (match_ipfs_length(data->payload[1], data->payload_len[1])) return true; } if (match_ipfs_mu(data->payload[1], data->payload_len[1])) { if (match_ipfs_single(data->payload[0], data->payload_len[0])) return true; if (match_ipfs_length(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_ipfs = { LPI_PROTO_IPFS, LPI_CATEGORY_P2P, "IPFS", 10, match_ipfs }; void register_ipfs(LPIModuleMap *mod_map) { register_protocol(&lpi_ipfs, mod_map); } ================================================ FILE: lib/tcp/lpi_ipop.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ipop_payload(uint32_t payload, uint32_t len) { uint16_t *len_ptr; if (!MATCH(payload, ANY, ANY, 0x72, 0x00)) return false; len_ptr = (uint16_t *)(&payload); if (ntohs(*len_ptr) + 4 != len) return false; return true; } static inline bool match_ipop(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_ipop_payload(data->payload[0], data->payload_len[0])) return false; if (!match_ipop_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_ipop = { LPI_PROTO_IPOP, LPI_CATEGORY_P2P, "IPOP_TCP", 8, match_ipop }; void register_ipop(LPIModuleMap *mod_map) { register_protocol(&lpi_ipop, mod_map); } ================================================ FILE: lib/tcp/lpi_ipsharkk.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* IPSharkk P2P Proxy */ static inline bool match_ipsharkk_ssl(uint32_t payload) { if (MATCH(payload, 0x16, 0x03, 0x03, 0x00)) return true; return false; } static inline bool match_ipsharkk_4f(uint32_t payload) { if (MATCH(payload, 0x4f, 0x1b, 0x4d, ANY)) return true; return false; } static inline bool match_ipsharkk(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_ipsharkk_ssl(data->payload[0])) { if (match_ipsharkk_4f(data->payload[1])) return true; } if (match_ipsharkk_ssl(data->payload[1])) { if (match_ipsharkk_4f(data->payload[0])) return true; } return false; } static lpi_module_t lpi_ipsharkk = { LPI_PROTO_IPSHARKK, LPI_CATEGORY_TUNNELLING, "IPSharkk", 15, match_ipsharkk }; void register_ipsharkk(LPIModuleMap *mod_map) { register_protocol(&lpi_ipsharkk, mod_map); } ================================================ FILE: lib/tcp/lpi_irc.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_irc(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "PASS")) return true; if (match_str_either(data, "NICK")) return true; if (MATCHSTR(data->payload[0], "\x0aNIC")) return true; if (MATCHSTR(data->payload[1], "\x0aNIC")) return true; if (match_str_both(data, ":irc", "USER")) return true; if (match_str_both(data, ":loc", "MODE")) return true; /* Trying to match on broken IRC implementations :) */ if (data->server_port == 6667 || data->client_port == 6667) { if (match_str_either(data, "ERRO")) return true; } return false; } static lpi_module_t lpi_irc = { LPI_PROTO_IRC, LPI_CATEGORY_CHAT, "IRC", 2, match_irc }; void register_irc(LPIModuleMap *mod_map) { register_protocol(&lpi_irc, mod_map); } ================================================ FILE: lib/tcp/lpi_java.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_java_serial(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len != 4) return false; if (MATCH(payload, 0xac, 0xed, 0x00, 0x05)) return true; return false; } static inline bool match_java(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_java_serial(data->payload[0], data->payload_len[0])) return false; if (!match_java_serial(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_java = { LPI_PROTO_JAVA, LPI_CATEGORY_SERIALISATION, "JavaObjectSerialised", 5, match_java }; void register_java(LPIModuleMap *mod_map) { register_protocol(&lpi_java, mod_map); } ================================================ FILE: lib/tcp/lpi_jedi.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_jedi(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Citrix have a protocol called JEDI which is used for streaming * in products like GoToMyPC */ if (match_str_both(data, "JEDI", "JEDI")) return true; return false; } static lpi_module_t lpi_jedi = { LPI_PROTO_JEDI, LPI_CATEGORY_REMOTE, "Citrix_Jedi", 3, match_jedi }; void register_jedi(LPIModuleMap *mod_map) { register_protocol(&lpi_jedi, mod_map); } ================================================ FILE: lib/tcp/lpi_jx3online.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_jx3_2c(uint32_t payload, uint32_t len) { if (len == 44 && MATCH(payload, 0x2c, 0x00, 0x20, 0x00)) return true; return false; } static inline bool match_jx3_varying(uint32_t payload, uint32_t len) { /* There appear to be lots of valid patterns here, but I'm * just going to focus on the major ones for now */ if (len == 28 && MATCH(payload, 0x1c, 0x00, ANY, ANY)) return true; return false; } static inline bool match_jx3online(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_jx3_2c(data->payload[0], data->payload_len[0])) { if (match_jx3_varying(data->payload[1], data->payload_len[1])) return true; } if (match_jx3_2c(data->payload[1], data->payload_len[1])) { if (match_jx3_varying(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_jx3online = { LPI_PROTO_JX3ONLINE, LPI_CATEGORY_GAMING, "JX3Online", 201, match_jx3online }; void register_jx3online(LPIModuleMap *mod_map) { register_protocol(&lpi_jx3online, mod_map); } ================================================ FILE: lib/tcp/lpi_kakao.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_kakao_req(uint32_t payload, uint32_t len) { if (len < 250) return false; if (MATCH(payload, 0x00, 0x01, 0x00, 0x00)) return true; return false; } static inline bool match_kakao_resp(uint32_t payload, uint32_t len) { if (payload + 4 == len) return true; return false; } static inline bool match_kakao(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_kakao_req(data->payload[0], data->payload_len[0])) { if (match_kakao_resp(data->payload[1], data->payload_len[1])) { return true; } } if (match_kakao_req(data->payload[1], data->payload_len[1])) { if (match_kakao_resp(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_kakao = { LPI_PROTO_KAKAO, LPI_CATEGORY_CHAT, "Kakao", 43, match_kakao }; void register_kakao(LPIModuleMap *mod_map) { register_protocol(&lpi_kakao, mod_map); } ================================================ FILE: lib/tcp/lpi_kankan_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_kankan_44(uint32_t payload, uint32_t len) { if (len != 44) return false; if (MATCH(payload, 0x01, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_kankan_28(uint32_t payload, uint32_t len) { if (len != 28) return false; if (MATCH(payload, 0x01, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_kankan_140(uint32_t payload, uint32_t len) { if (len != 140) return false; if (MATCH(payload, 0x01, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_kankan_any(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x01, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_xmp_04_req(uint32_t payload, uint32_t len) { if (len < 92) return false; if (MATCH(payload, 0x04, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_xmp_04_resp(uint32_t payload, uint32_t len) { if (len != 4) return false; if (MATCH(payload, 0x04, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_kankan(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->client_port != 80 && data->server_port != 80) return false; if (match_kankan_44(data->payload[0], data->payload_len[0])) { if (match_kankan_28(data->payload[1], data->payload_len[1])) return true; } if (match_kankan_44(data->payload[1], data->payload_len[1])) { if (match_kankan_28(data->payload[0], data->payload_len[0])) return true; } if (match_kankan_140(data->payload[0], data->payload_len[0])) { if (match_kankan_any(data->payload[1], data->payload_len[1])) return true; } if (match_kankan_140(data->payload[1], data->payload_len[1])) { if (match_kankan_any(data->payload[0], data->payload_len[0])) return true; } if (match_xmp_04_req(data->payload[0], data->payload_len[0])) { if (match_xmp_04_resp(data->payload[1], data->payload_len[1])) return true; } if (match_xmp_04_req(data->payload[1], data->payload_len[1])) { if (match_xmp_04_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_kankan = { LPI_PROTO_KANKAN, LPI_CATEGORY_STREAMING, "KankanTCP", 70, match_kankan }; void register_kankan_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_kankan, mod_map); } ================================================ FILE: lib/tcp/lpi_kaseya.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_kaseya_req(uint32_t payload, uint32_t len) { /* Seen quite a few flows where only the response is present */ if (len == 0) return true; if (!MATCH(payload, 0x4a, 0x5e, 0x7a, 0x04)) return false; if (len == 48) return true; if (len == 52) return true; if (len == 25) return true; return false; } static inline bool match_kaseya_resp(uint32_t payload, uint32_t len) { if (len == 0) return true; if (!MATCH(payload, 0x4a, 0x5e, 0x7a, 0x04)) return false; /* if (len < 200) return false; */ return true; } static inline bool match_kaseya(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_kaseya_req(data->payload[0], data->payload_len[0])) { if (match_kaseya_resp(data->payload[1], data->payload_len[1])) return true; } if (match_kaseya_req(data->payload[1], data->payload_len[1])) { if (match_kaseya_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_kaseya = { LPI_PROTO_KASEYA, LPI_CATEGORY_REMOTE, "Kaseya", 7, match_kaseya }; void register_kaseya(LPIModuleMap *mod_map) { register_protocol(&lpi_kaseya, mod_map); } ================================================ FILE: lib/tcp/lpi_kaspersky.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_kaspersky_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 443 && data->client_port != 443) return false; return match_kaspersky(data); } static lpi_module_t lpi_kaspersky = { LPI_PROTO_KASPERSKY, LPI_CATEGORY_SECURITY, "Kaspersky_TCP", 4, match_kaspersky_tcp }; void register_kaspersky(LPIModuleMap *mod_map) { register_protocol(&lpi_kaspersky, mod_map); } ================================================ FILE: lib/tcp/lpi_kik.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_kik(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This rule tries to match the traffic for Kik, a somewhat popular * IM app for mobile devices. * * The problem with Kik is that it uses port 5223 and SSL, so it is * very difficult to distinguish from ApplePush */ if (!match_ssl(data)) return false; /* Port 5223 is used */ if (data->server_port != 5223 && data->client_port != 5223) return false; /* The key to matching Kik is bytes 3 and 4 of the incoming SSL * handshake packet. They are slightly different to those seen * for ApplePush flows. */ if (MATCH(data->payload[0], 0x16, 0x03, 0x01, 0x0c)) return true; if (MATCH(data->payload[1], 0x16, 0x03, 0x01, 0x0c)) return true; if (MATCH(data->payload[0], 0x16, 0x03, 0x03, 0x0e)) return true; if (MATCH(data->payload[1], 0x16, 0x03, 0x03, 0x0e)) return true; if (MATCH(data->payload[0], 0x16, 0x03, 0x01, 0x0e)) return true; if (MATCH(data->payload[1], 0x16, 0x03, 0x01, 0x0e)) return true; return false; } static lpi_module_t lpi_kik = { LPI_PROTO_KIK, LPI_CATEGORY_CHAT, "Kik", 5, /* Should be a higher priority than ApplePush */ match_kik }; void register_kik(LPIModuleMap *mod_map) { register_protocol(&lpi_kik, mod_map); } ================================================ FILE: lib/tcp/lpi_kingofglory_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* TODO make sure this is not a more generic tencent games protocol? */ static inline bool match_kog_64(uint32_t payload, uint32_t len) { if (len == 64 && MATCH(payload, 0x33, 0x66, 0x00, 0x09)) return true; return false; } static inline bool match_kog_other(uint32_t payload, uint32_t len) { if (len < 100 && MATCH(payload, 0x33, 0x66, 0x00, 0x09)) return true; return false; } static inline bool match_kingofglory_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_kog_64(data->payload[0], data->payload_len[0])) { if (match_kog_other(data->payload[1], data->payload_len[1])) return true; } if (match_kog_64(data->payload[1], data->payload_len[1])) { if (match_kog_other(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_kingofglory_tcp = { LPI_PROTO_KINGOFGLORY, LPI_CATEGORY_GAMING, "KingOfGlory_TCP", 99, match_kingofglory_tcp }; void register_kingofglory_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_kingofglory_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_kuaibo.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* First two bytes are actually a length field, byte 3 is always 0x03, * byte 4 is probably a message type (must match both ways). * * However, since messages of a certain type always seem to have the same * length for the request and response, I prefer matching like this * where I can enforce the length requirement. */ static inline bool match_1c_req(uint32_t payload, uint32_t len) { if (len == 28 && MATCH(payload, 0x00, 0x1c, 0x03, 0x03)) return true; return false; } static inline bool match_0c_resp(uint32_t payload, uint32_t len) { if (len == 12 && MATCH(payload, 0x00, 0x0c, 0x03, 0x03)) return true; return false; } static inline bool match_30_req(uint32_t payload, uint32_t len) { if (len == 48 && MATCH(payload, 0x00, 0x30, 0x03, 0x06)) return true; return false; } static inline bool match_20_resp(uint32_t payload, uint32_t len) { if (len == 32 && MATCH(payload, 0x00, 0x20, 0x03, 0x06)) return true; return false; } static inline bool match_24_req(uint32_t payload, uint32_t len) { if (len == 36 && MATCH(payload, 0x00, 0x24, 0x03, 0x01)) return true; return false; } static inline bool match_10_resp(uint32_t payload, uint32_t len) { if (len == 16 && MATCH(payload, 0x00, 0x10, 0x03, 0x01)) return true; return false; } static inline bool match_kuaibo(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_1c_req(data->payload[0], data->payload_len[0])) { if (match_0c_resp(data->payload[1], data->payload_len[1])) return true; } if (match_1c_req(data->payload[1], data->payload_len[1])) { if (match_0c_resp(data->payload[0], data->payload_len[0])) return true; } if (match_30_req(data->payload[0], data->payload_len[0])) { if (match_20_resp(data->payload[1], data->payload_len[1])) return true; } if (match_30_req(data->payload[1], data->payload_len[1])) { if (match_20_resp(data->payload[0], data->payload_len[0])) return true; } if (match_24_req(data->payload[0], data->payload_len[0])) { if (match_10_resp(data->payload[1], data->payload_len[1])) return true; } if (match_24_req(data->payload[1], data->payload_len[1])) { if (match_10_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_kuaibo = { LPI_PROTO_KUAIBO, LPI_CATEGORY_STREAMING, "Kuaibo", 51, match_kuaibo }; void register_kuaibo(LPIModuleMap *mod_map) { register_protocol(&lpi_kuaibo, mod_map); } ================================================ FILE: lib/tcp/lpi_ldap.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ldap_payload(uint32_t payload, uint32_t len) { uint8_t *byte = ((uint8_t *)&payload); uint16_t struct_len = 0; if (len == 0) return true; byte ++; if (((*byte) & 0x80) == 0x80) { uint8_t bytes_required = ((*byte) & 0x7f); if (bytes_required > 2 || bytes_required == 0) return false; if (bytes_required == 1) { if (len > 255) return false; byte ++; struct_len = 3 + ((uint8_t)(*byte)); if (!MATCH(payload, 0x30, ANY, ANY, 0x02)) return false; } else { struct_len = 4 + ntohs(*((uint16_t *)(byte + 1))); if (!MATCH(payload, 0x30, ANY, ANY, ANY)) return false; } } else { if (!MATCH(payload, 0x30, ANY, 0x02, 0x01)) return false; if (len > 255) return false; struct_len = (*byte) + 2; } if (struct_len != len) return false; return true; } static inline bool match_ldap(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_ldap_payload(data->payload[0], data->payload_len[0])) return false; if (!match_ldap_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_ldap = { LPI_PROTO_LDAP, LPI_CATEGORY_SERVICES, "LDAP", 3, match_ldap }; void register_ldap(LPIModuleMap *mod_map) { register_protocol(&lpi_ldap, mod_map); } ================================================ FILE: lib/tcp/lpi_lifeforge.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_lifeforge_login(uint32_t payload, uint32_t len) { uint32_t plen = bswap_le_to_host32(payload); /* I've only seen 0x25 in here, but that may vary depending on * username length? */ if (MATCH(payload, ANY, 0x00, 0x00, 0x00)) { if (len == plen + 4) return true; } return false; } static inline bool match_lifeforge_ping(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x0e, 0x00, 0x00, 0x00)) { if (len == 18) return true; if (len == 34) return true; } return false; } static inline bool match_lifeforge(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_lifeforge_login(data->payload[0], data->payload_len[0])) { if (match_lifeforge_ping(data->payload[1], data->payload_len[1])) return true; } if (match_lifeforge_login(data->payload[1], data->payload_len[1])) { if (match_lifeforge_ping(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_lifeforge = { LPI_PROTO_LIFEFORGE, LPI_CATEGORY_GAMING, "LifeForge", 150, match_lifeforge }; void register_lifeforge(LPIModuleMap *mod_map) { register_protocol(&lpi_lifeforge, mod_map); } ================================================ FILE: lib/tcp/lpi_line.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_line_request(uint32_t payload, uint32_t len) { /* This packet varies in length but is always ~680 bytes if we * end up needing a stronger rule */ if (MATCH(payload, 0x80, 0x02, 0x00, 0x01)) return true; if (len == 12 && MATCH(payload, 0x80, 0x02, 0x00, 0x06)) return true; return false; } static inline bool match_line_response(uint32_t payload, uint32_t len) { if (len == 60 && MATCH(payload, 0x80, 0x02, 0x00, 0x04)) return true; return false; } static inline bool match_line(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Restrict to port 443 for now */ if (data->server_port != 443 && data->client_port != 443) return false; /* This looks a lot like an SSL 2.0 handshake */ if (match_line_request(data->payload[0], data->payload_len[0])) { if (match_line_response(data->payload[1], data->payload_len[1])) return true; } if (match_line_request(data->payload[1], data->payload_len[1])) { if (match_line_response(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_line = { LPI_PROTO_LINE, LPI_CATEGORY_CHAT, "Line", 12, match_line }; void register_line(LPIModuleMap *mod_map) { register_protocol(&lpi_line, mod_map); } ================================================ FILE: lib/tcp/lpi_litecoin.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_lc_magic(uint32_t payload) { if (MATCH(payload, 0xfb, 0xc0, 0xb6, 0xdb)) return true; return false; } static inline bool match_litecoin(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 9333 */ if (match_lc_magic(data->payload[0]) && match_lc_magic(data->payload[1])) return true; return false; } static lpi_module_t lpi_litecoin = { LPI_PROTO_LITECOIN, LPI_CATEGORY_ECOMMERCE, "Litecoin", 5, match_litecoin }; void register_litecoin(LPIModuleMap *mod_map) { register_protocol(&lpi_litecoin, mod_map); } ================================================ FILE: lib/tcp/lpi_llp2p.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Low Latency P2P -- open-source Chinese P2P streaming software. * https://github.com/momomou/llp2p */ static inline bool match_llp2p_get(uint32_t payload, uint32_t len) { /* Outgoing request looks like an HTTP GET -- maybe aiming to fool * DPI software? */ /* Only seen len=133 so far but this seems like it could change */ if (MATCH(payload, 'G', 'E', 'T', 0x20)) return true; return false; } static inline bool match_llp2p_update(uint32_t payload, uint32_t len) { /* Not sure on the length requirement, but I've only seen 454 * bytes so far. */ if (MATCH(payload, 0x13, 0x00, 0x01, 0x00) && len == 454) return true; return false; } static inline bool match_llp2p(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_llp2p_get(data->payload[0], data->payload_len[0])) { if (match_llp2p_update(data->payload[1], data->payload_len[1])) return true; } if (match_llp2p_get(data->payload[1], data->payload_len[1])) { if (match_llp2p_update(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_llp2p = { LPI_PROTO_LLP2P, LPI_CATEGORY_P2PTV, "LLP2P", 12, match_llp2p }; void register_llp2p(LPIModuleMap *mod_map) { register_protocol(&lpi_llp2p, mod_map); } ================================================ FILE: lib/tcp/lpi_maplestory_china.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_cms_hello(uint32_t payload, uint32_t len) { if (len == 16 || len == 536) { if (MATCH(payload, 0x0e, 0x00, 0x8d, 0x00)) return true; if (MATCH(payload, 0x0e, 0x00, 0x8e, 0x00)) return true; if (MATCH(payload, 0x0e, 0x00, 0x8f, 0x00)) return true; if (MATCH(payload, 0x0e, 0x00, 0x90, 0x00)) return true; if (MATCH(payload, 0x0e, 0x00, 0x91, 0x00)) return true; } return false; } static inline bool match_cms_alt(uint32_t payload, uint32_t len) { if (len == 16) { if (MATCH(payload, 0x0e, 0x00, 0xba, 0x00)) return true; if (MATCH(payload, 0x0e, 0x00, 0xbb, 0x00)) return true; } return false; } static inline bool match_cms_51(uint32_t payload, uint32_t len) { if (len == 16) { if (MATCH(payload, 0x0e, 0x00, 0xc1, 0x00)) { return true; } } return false; } static inline bool match_maplestory_china(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Can also restrict to ports 8585 and 8586 if required */ if (match_cms_hello(data->payload[0], data->payload_len[0])) { if (data->payload_len[1] == 42) return true; } if (match_cms_hello(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] == 42) return true; } if (match_cms_alt(data->payload[0], data->payload_len[0])) { if (data->payload_len[1] == 40) return true; } if (match_cms_alt(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] == 40) return true; } if (match_cms_51(data->payload[0], data->payload_len[0])) { if (data->payload_len[1] == 51) return true; } if (match_cms_51(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] == 51) return true; } return false; } static lpi_module_t lpi_maplestory_china = { LPI_PROTO_MAPLESTORY_CHINA, LPI_CATEGORY_GAMING, "MaplestoryChina", 12, match_maplestory_china }; void register_maplestory_china(LPIModuleMap *mod_map) { register_protocol(&lpi_maplestory_china, mod_map); } ================================================ FILE: lib/tcp/lpi_maxicloud.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_maxicloud(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* MaxiCloud actually uses HTTP, but there is some weird behaviour * with some servers where we see a 1 byte response to the login * POST prior to the actual HTTP response so we can distinguish these * flows as MaxiCloud specifically. */ if (MATCHSTR(data->payload[0], "POST") && MATCH(data->payload[1], 0x00, 0x00, 0x00, 0x00) && data->payload_len[1] == 1) return true; if (MATCHSTR(data->payload[1], "POST") && MATCH(data->payload[0], 0x00, 0x00, 0x00, 0x00) && data->payload_len[0] == 1) return true; return false; } static lpi_module_t lpi_maxicloud = { LPI_PROTO_MAXICLOUD, LPI_CATEGORY_CLOUD, "MaxiCloud", 100, match_maxicloud }; void register_maxicloud(LPIModuleMap *mod_map) { register_protocol(&lpi_maxicloud, mod_map); } ================================================ FILE: lib/tcp/lpi_message4u.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_message4u(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "m4ul")) return true; return false; } static lpi_module_t lpi_message4u = { LPI_PROTO_M4U, LPI_CATEGORY_TELCO, "Message4U", 3, match_message4u }; void register_message4u(LPIModuleMap *mod_map) { register_protocol(&lpi_message4u, mod_map); } ================================================ FILE: lib/tcp/lpi_minecraft.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mc_server_ping(uint32_t payload, uint32_t len) { /* There are two variants of the server ping * * http://mc.kev009.com/Server_List_Ping */ if (len == 1) { if (MATCH(payload, 0xfe, 0x00, 0x00, 0x00)) return true; } if (len == 2) { if (MATCH(payload, 0xf3, 0x01, 0x00, 0x00)) return true; } return false; } static inline bool match_mc_kick(uint32_t payload, uint32_t len) { uint32_t str_len; if (!MATCH(payload, 0xff, ANY, ANY, 0x00)) return false; /* Middle 2 bytes are the length of the string following the initial * header. Unfortunately there is more to the packet after the string, * so we just have to check that the length makes sense given the size * of the packet */ str_len = (ntohl(payload) >> 8) & 0xffff; if (str_len >= len) return false; return true; } static inline bool match_mc_handshake(uint32_t payload, uint32_t len) { /* Ref: http://wiki.vg/Protocol */ uint32_t replen; replen = ntohl(payload) >> 24; if (replen == len - 1) { if (MATCH(payload, ANY, 0x00, ANY, ANY) && len - 1 <= 255) return true; if (MATCH(payload, ANY, 0x01, ANY, ANY) && len - 1 >= 256) return true; } /* Some handshakes seem to be undersized? */ if (len == 187 && MATCH(payload, 0xb9, 0x01, 0x01, 0x0e)) return true; if (len == 188 && MATCH(payload, 0xba, 0x01, 0x01, 0x0f)) return true; if (len == 189 && MATCH(payload, 0xbb, 0x01, 0x01, 0x10)) return true; if (len == 190 && MATCH(payload, 0xbc, 0x01, 0x01, 0x11)) return true; return false; } static inline bool match_mc_v5_handshake(uint32_t payload, uint32_t len) { uint32_t replen; uint32_t serverlen; replen = ntohl(payload) >> 24; serverlen = ntohl(payload) & 0xff; if (replen == len - 1 && len - 1 <= 255) { if (!MATCH(payload, ANY, 0x00, 0x05, ANY)) return false; if (serverlen != replen - 6) return false; return true; } return false; } static inline bool match_mc_handshake_reply(uint32_t payload, uint32_t len) { /* Not technically a handshake reply, as the protocol spec doesn't * have one. This pattern is what we see in the other direction * after a handshake though. */ if (len == 173) { if (MATCH(payload, 0xab, 0x01, 0x01, 0x00)) return true; } if (len == 174) { if (MATCH(payload, 0xac, 0x01, 0x01, 0x00)) return true; } if (len == 22 && MATCH(payload, 0x15, 0x00, 0xd4, 0x02)) return true; if (len == 24 && MATCH(payload, 0x17, 0x00, 0xcf, 0x02)) return true; if (len == 29 && MATCH(payload, 0x1c, 0x00, 0xd2, 0x01)) return true; if (len == 30 && MATCH(payload, 0x1d, 0x00, 0xd4, 0x02)) return true; if (len == 4) { if (MATCH(payload, 0x03, 0x03, 0x80, 0x02)) return true; } return false; } static inline bool match_minecraft(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_mc_server_ping(data->payload[0], data->payload_len[0])) { if (match_mc_kick(data->payload[1], data->payload_len[1])) { return true; } } if (match_mc_server_ping(data->payload[1], data->payload_len[1])) { if (match_mc_kick(data->payload[0], data->payload_len[0])) { return true; } } if (match_mc_handshake(data->payload[0], data->payload_len[0])) { if (match_mc_handshake_reply(data->payload[1], data->payload_len[1])) return true; /* apparently we can have handshake reqs in both dirs? */ if (match_mc_handshake(data->payload[1], data->payload_len[1])) return true; } if (match_mc_handshake(data->payload[1], data->payload_len[1])) { if (match_mc_handshake_reply(data->payload[0], data->payload_len[0])) return true; /* apparently we can have handshake reqs in both dirs? */ if (match_mc_handshake(data->payload[0], data->payload_len[0])) return true; } /* Some servers running old versions of MC are annoying and send * single byte packets */ if (match_mc_v5_handshake(data->payload[0], data->payload_len[0])) { if (data->payload_len[1] == 1) return true; } if (match_mc_v5_handshake(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] == 1) return true; } return false; } static lpi_module_t lpi_minecraft = { LPI_PROTO_MINECRAFT, LPI_CATEGORY_GAMING, "Minecraft", 35, match_minecraft }; void register_minecraft(LPIModuleMap *mod_map) { register_protocol(&lpi_minecraft, mod_map); } ================================================ FILE: lib/tcp/lpi_mitglieder.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mitglieder(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_chars_either(data, 0x04, 0x01, 0x00, 0x19)) return true; return false; } static lpi_module_t lpi_mitglieder = { LPI_PROTO_MITGLIEDER, LPI_CATEGORY_MALWARE, "Mitglieder_Trojan", 8, match_mitglieder }; void register_mitglieder(LPIModuleMap *mod_map) { register_protocol(&lpi_mitglieder, mod_map); } ================================================ FILE: lib/tcp/lpi_mms.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mms_server(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x01, 0x00, 0x00, ANY)) return true; return false; } static inline bool match_mms_client(uint32_t payload, uint32_t len) { if (len != 144) return false; if (MATCH(payload, 0x01, 0x00, 0x00, ANY)) return true; return false; } static inline bool match_mms(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Microsoft Media Server protocol */ if (match_mms_server(data->payload[0], data->payload_len[0])) { if (match_mms_client(data->payload[1], data->payload_len[1])) return true; } if (match_mms_server(data->payload[1], data->payload_len[1])) { if (match_mms_client(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_mms = { LPI_PROTO_MMS, LPI_CATEGORY_STREAMING, "MMS", 6, match_mms }; void register_mms(LPIModuleMap *mod_map) { register_protocol(&lpi_mms, mod_map); } ================================================ FILE: lib/tcp/lpi_mongo.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Mongo protocol uses the first four bytes as a length field */ static inline bool match_mongo_req(uint32_t payload, uint32_t len) { uint32_t mongolen = bswap_le_to_host32(payload); /* Most requests are very small */ if (MATCH(payload, ANY, 0x00, 0x00, 0x00) || MATCH(payload, ANY, 0x01, 0x00, 0x00)) { /* Some mongo libraries manage to split requests across * multiple packets, so we can't do a direct length * match :( */ if (mongolen >= len) return true; } return false; } static inline bool match_mongo_reply(uint32_t payload, uint32_t len) { uint32_t mongolen = bswap_le_to_host32(payload); /* If reply is short, mongolen should match the packet length */ if (mongolen == len) return true; /* If mongolen is large, packet len should be MTU-sized. Here, * we'll assume an MTU of at least 1400 (sorry, people with * tons of encapsulation) */ if (mongolen > len) { if (len >= 1400) return true; } return false; } static inline bool match_mongo(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Restrict to the default mongo port for now */ if (data->server_port != 27017 && data->client_port != 27017) return false; if (match_mongo_req(data->payload[0], data->payload_len[0])) { if (match_mongo_reply(data->payload[1], data->payload_len[1])) return true; } if (match_mongo_req(data->payload[1], data->payload_len[1])) { if (match_mongo_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_mongo = { LPI_PROTO_MONGO, LPI_CATEGORY_DATABASES, "MongoDB", 88, match_mongo }; void register_mongo(LPIModuleMap *mod_map) { register_protocol(&lpi_mongo, mod_map); } ================================================ FILE: lib/tcp/lpi_mp2p.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mp2p(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Looking for STR, SIZ, MD5, GO!! */ if (match_str_both(data, "STR ", "SIZ ")) return true; if (MATCHSTR(data->payload[0], "STR ")) { if (data->payload_len[0] == 10 || data->payload_len[0] == 11) return true; } if (MATCHSTR(data->payload[1], "STR ")) { if (data->payload_len[1] == 10 || data->payload_len[1] == 11) return true; } return false; } static lpi_module_t lpi_mp2p = { LPI_PROTO_MP2P, LPI_CATEGORY_P2P, "MP2P_TCP", 2, match_mp2p }; void register_mp2p(LPIModuleMap *mod_map) { register_protocol(&lpi_mp2p, mod_map); } ================================================ FILE: lib/tcp/lpi_msn.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_msn(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "ANS ")) return true; if (match_str_either(data, "VER ")) return true; return false; } static lpi_module_t lpi_msn = { LPI_PROTO_MSN, LPI_CATEGORY_CHAT, "MSN", 2, match_msn }; void register_msn(LPIModuleMap *mod_map) { register_protocol(&lpi_msn, mod_map); } ================================================ FILE: lib/tcp/lpi_msnc.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_msnc(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* http://msnpiki.msnfanatic.com/index.php/MSNC:File_Transfer#Direct_connection:_Handshake */ /* MSNC sends the length as a separate packet before the data. To * confirm MSNC, you have to look at the second packet sent by the * connecting host. It should begin with 'foo'. */ if (match_str_both(data, "\x30\x00\x00\x00", "\x04\x00\x00\x00")) { if (data->payload_len[0] == 4 && data->payload_len[1] == 4) return true; } if (match_str_both(data, "\x10\x00\x00\x00", "\x04\x00\x00\x00")) { if (MATCH(data->payload[0], 0x04, 0x00, 0x00, 0x00)) { if (data->payload_len[0] == 4) return true; } if (MATCH(data->payload[1], 0x04, 0x00, 0x00, 0x00)) { if (data->payload_len[1] == 4) return true; } } return false; } static lpi_module_t lpi_msnc = { LPI_PROTO_MSNC, LPI_CATEGORY_FILES, "MSNC", 3, match_msnc }; void register_msnc(LPIModuleMap *mod_map) { register_protocol(&lpi_msnc, mod_map); } ================================================ FILE: lib/tcp/lpi_msnv.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_msnv(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "\x01\x01\x00\x70", "\x00\x01\x00\x64")) return true; return false; } static lpi_module_t lpi_msnv = { LPI_PROTO_MSNV, LPI_CATEGORY_CHAT, "MSN_Voice", 3, match_msnv }; void register_msnv(LPIModuleMap *mod_map) { register_protocol(&lpi_msnv, mod_map); } ================================================ FILE: lib/tcp/lpi_munin.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_munin(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Can also match on TCP port 4949 if we're having false positive * problems */ /* Also, one common munin command (seen in the other direction) * is "cap " */ if (match_str_either(data, "# mu")) return true; return false; } static lpi_module_t lpi_munin = { LPI_PROTO_MUNIN, LPI_CATEGORY_MONITORING, "Munin", 6, match_munin }; void register_munin(LPIModuleMap *mod_map) { register_protocol(&lpi_munin, mod_map); } ================================================ FILE: lib/tcp/lpi_mysql.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mysql(lpi_data_t *data, lpi_module_t *mod UNUSED) { uint32_t stated_len = 0; if (data->payload_len[0] == 0 && data->payload_len[1] == 0) return false; /* Need to enforce some sort of port checking here */ if (data->server_port != 3306 && data->client_port != 3306) return false; stated_len = (data->payload[0] & 0xffffff); if (data->payload_len[0] > 0 && stated_len != data->payload_len[0] - 4) return false; stated_len = (data->payload[1] & 0xffffff); if (data->payload_len[1] > 0 && stated_len != data->payload_len[1] - 4) return false; if (MATCH(data->payload[0], ANY, ANY, ANY, 0x00) && MATCH(data->payload[1], ANY, ANY, ANY, 0x01)) return true; if (MATCH(data->payload[1], ANY, ANY, ANY, 0x00) && MATCH(data->payload[0], ANY, ANY, ANY, 0x01)) return true; if (MATCH(data->payload[0], ANY, ANY, ANY, 0x00) && data->payload_len[1] == 0) return true; if (MATCH(data->payload[1], ANY, ANY, ANY, 0x00) && data->payload_len[0] == 0) return true; return false; } static lpi_module_t lpi_mysql = { LPI_PROTO_MYSQL, LPI_CATEGORY_DATABASES, "MySQL", 4, match_mysql }; void register_mysql(LPIModuleMap *mod_map) { register_protocol(&lpi_mysql, mod_map); } ================================================ FILE: lib/tcp/lpi_mystery_8000.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mystery_8000(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* These patterns typically appear on UDP port 8000 (and occasionally * TCP port 80) */ if (!match_8000_payload(data->payload[0], data->payload_len[0])) return false; if (!match_8000_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_mystery_8000 = { LPI_PROTO_MYSTERY_8000, LPI_CATEGORY_NO_CATEGORY, "Mystery_8000", 250, match_mystery_8000 }; void register_mystery_8000(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_8000, mod_map); } ================================================ FILE: lib/tcp/lpi_mystery_9000.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mystery_9000_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len != 80) return false; if (MATCH(payload, 0x4c, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_mystery_9000(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Not entirely sure what this is - looks kinda like Samba that is * occurring primarily on port 9000. Many storage solutions use * port 9000 as a default port so this is a possibility, but the * use of this protocol is rather spammy */ if (!match_mystery_9000_payload(data->payload[0], data->payload_len[0])) return false; if (!match_mystery_9000_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_mystery_9000 = { LPI_PROTO_MYSTERY_9000, LPI_CATEGORY_NO_CATEGORY, "Mystery_9000", 250, match_mystery_9000 }; void register_mystery_9000(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_9000, mod_map); } ================================================ FILE: lib/tcp/lpi_mystery_conn.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mystery_conn(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Appears to be some sort of file transfer protocol, but * trying to google for a protocol using words such as "connect" * and "receive" is not very helpful */ if (match_str_both(data, "conn", "reci")) return true; if (match_str_either(data, "reci")) { if (data->payload_len[1] == 0) return true; if (data->payload_len[0] == 0) return true; } return false; } static lpi_module_t lpi_mystery_conn = { LPI_PROTO_MYSTERY_CONN, LPI_CATEGORY_NO_CATEGORY, "Mystery_conn", 250, match_mystery_conn }; void register_mystery_conn(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_conn, mod_map); } ================================================ FILE: lib/tcp/lpi_mystery_iG.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mystery_iG(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Another mystery protocol - the payload pattern is the same in * both directions. Have observed this on port 20005 and port 8080, * but not obvious what exactly this is */ if (match_str_both(data, "\xd7\x69\x47\x26", "\xd7\x69\x47\x26")) return true; if (MATCH(data->payload[0], 0xd7, 0x69, 0x47, 0x26)) { if (data->payload_len[1] == 0) return true; } if (MATCH(data->payload[1], 0xd7, 0x69, 0x47, 0x26)) { if (data->payload_len[0] == 0) return true; } return false; } static lpi_module_t lpi_mystery_iG = { LPI_PROTO_MYSTERY_IG, LPI_CATEGORY_NO_CATEGORY, "Mystery_iG", 250, match_mystery_iG }; void register_mystery_iG(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_iG, mod_map); } ================================================ FILE: lib/tcp/lpi_mystery_pspr.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mystery_pspr(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "PSPr", "PSPr")) return true; if (match_str_either(data, "PSPr")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } return false; } static lpi_module_t lpi_mystery_pspr = { LPI_PROTO_MYSTERY_PSPR, LPI_CATEGORY_NO_CATEGORY, "Mystery_PSPR", 250, match_mystery_pspr }; void register_mystery_pspr(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_pspr, mod_map); } ================================================ FILE: lib/tcp/lpi_mystery_rxxf.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mystery_rxxf(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Things we know about this protocol: * * One endpoint is always running on TCP port 3128 (squid). * The other end always seems to be in Chinese address space. * Bytes 5-8 are a length field. */ if (match_str_either(data, "RXXF")) return true; return false; } static lpi_module_t lpi_mystery_rxxf = { LPI_PROTO_MYSTERY_RXXF, LPI_CATEGORY_NO_CATEGORY, "Mystery_RXXF", 250, match_mystery_rxxf }; void register_mystery_rxxf(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_rxxf, mod_map); } ================================================ FILE: lib/tcp/lpi_mystery_symantec.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mystery_symantec(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This protocol definitely goes to hosts in the Symantec IP space, * but it is not exactly clear what the purpose of it is */ /* Always on TCP port 80 */ if (data->server_port != 80 && data->client_port != 80) return false; if (data->payload_len[0] != 4 || data->payload_len[1] != 4) return false; if (MATCH(data->payload[0], 0x00, 0x00, 0x00, 0x00)) { if (MATCH(data->payload[1], 0x00, 0x00, 0x00, 0x00)) return false; if (MATCH(data->payload[1], 0x58, 0x54, 0x7d, 0x01)) return true; if (MATCH(data->payload[1], ANY, ANY, ANY, 0x00)) return true; } if (MATCH(data->payload[1], 0x00, 0x00, 0x00, 0x00)) { if (MATCH(data->payload[1], 0x58, 0x54, 0x7d, 0x01)) return true; if (MATCH(data->payload[0], ANY, ANY, ANY, 0x00)) return true; } return false; } static lpi_module_t lpi_mystery_symantec = { LPI_PROTO_MYSTERY_SYMANTEC, LPI_CATEGORY_NO_CATEGORY, "Mystery_Symantec", 250, match_mystery_symantec }; void register_mystery_symantec(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_symantec, mod_map); } ================================================ FILE: lib/tcp/lpi_mzinga.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mzinga(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "PCHA")) return true; return false; } static lpi_module_t lpi_mzinga = { LPI_PROTO_MZINGA, LPI_CATEGORY_CHAT, "Mzinga", 3, match_mzinga }; void register_mzinga(LPIModuleMap *mod_map) { register_protocol(&lpi_mzinga, mod_map); } ================================================ FILE: lib/tcp/lpi_naverp2p.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_naver_magic(uint32_t payload) { if (MATCH(payload, 0xcf, 0x10, 0x00, 0x1f)) return true; return false; } static inline bool match_naverp2p(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_naver_magic(data->payload[0])) { if (match_naver_magic(data->payload[1])) { return true; } } return false; } static lpi_module_t lpi_naverp2p = { LPI_PROTO_NAVER_P2P, LPI_CATEGORY_P2P, "NaverP2P", 29, match_naverp2p }; void register_naverp2p(LPIModuleMap *mod_map) { register_protocol(&lpi_naverp2p, mod_map); } ================================================ FILE: lib/tcp/lpi_ncsoft.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ncsoft(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_chars_either(data, 0x00, 0x05, 0x0c, 0x00)) return true; return false; } static lpi_module_t lpi_ncsoft = { LPI_PROTO_NCSOFT, LPI_CATEGORY_GAMING, "NCSoft", 4, /* Not the strongest rule, although this hasn't caused any problems * in the past */ match_ncsoft }; void register_ncsoft(LPIModuleMap *mod_map) { register_protocol(&lpi_ncsoft, mod_map); } ================================================ FILE: lib/tcp/lpi_ndt_tput.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ndt_tput(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* One-way throughput test */ if (MATCH(data->payload[0], 0x20, 0x21, 0x22, 0x23) && data->payload_len[1] == 0) { return true; } if (MATCH(data->payload[1], 0x20, 0x21, 0x22, 0x23) && data->payload_len[0] == 0) { return true; } return false; } static lpi_module_t lpi_ndt_tput = { LPI_PROTO_NDT_TPUT, LPI_CATEGORY_MONITORING, "NDTThroughput", 100, match_ndt_tput }; void register_ndt_tput(LPIModuleMap *mod_map) { register_protocol(&lpi_ndt_tput, mod_map); } ================================================ FILE: lib/tcp/lpi_netbios.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_netbios(lpi_data_t *data, lpi_module_t *mod UNUSED) { uint32_t stated_len = 0; if (MATCH(data->payload[0], 0x81, 0x00, ANY, ANY)) { stated_len = ntohl(data->payload[0]) & 0xffff; if (stated_len == data->payload_len[0] - 4) return true; } if (MATCH(data->payload[1], 0x81, 0x00, ANY, ANY)) { stated_len = ntohl(data->payload[1]) & 0xffff; if (stated_len == data->payload_len[1] - 4) return true; } return false; } static lpi_module_t lpi_netbios = { LPI_PROTO_NETBIOS, LPI_CATEGORY_SERVICES, "NetBIOS", 2, match_netbios }; void register_netbios(LPIModuleMap *mod_map) { register_protocol(&lpi_netbios, mod_map); } ================================================ FILE: lib/tcp/lpi_netcat_cctv.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_netcat_ff00(uint32_t payload, uint32_t len) { if (MATCHSTR(payload, "\xff\x00\x00\x00")) return true; return false; } static inline bool match_netcat_ff01(uint32_t payload, uint32_t len) { if (MATCHSTR(payload, "\xff\x01\x00\x00")) return true; return false; } static inline bool match_netcat_cctv(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Protocol used by Netcat branded IP Cameras * http://www.netcatcctv.com */ if (match_netcat_ff00(data->payload[0], data->payload_len[0])) { if (match_netcat_ff01(data->payload[1], data->payload_len[1])) return true; } if (match_netcat_ff00(data->payload[1], data->payload_len[1])) { if (match_netcat_ff01(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_netcat_cctv = { LPI_PROTO_NETCAT_CCTV, LPI_CATEGORY_IPCAMERAS, "NetcatCCTV", 20, match_netcat_cctv }; void register_netcat_cctv(LPIModuleMap *mod_map) { register_protocol(&lpi_netcat_cctv, mod_map); } ================================================ FILE: lib/tcp/lpi_netmfp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* .NET Message Framing Protocol */ static inline bool match_version_record(uint32_t payload, uint32_t len) { /* Length will probably vary */ /* Version, mode and via records are often included in the same * packet */ if (MATCH(payload, 0x00, 0x01, 0x00, 0x01)) return true; return false; } static inline bool match_upgrade_resp(uint32_t payload, uint32_t len) { if (len == 1 && MATCH(payload, 0x0a, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_netmfp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Limit to port 7150 for now -- this probably only corresponds to * one MS service that uses this protocol, but I'm going to play * it conservative. */ if (data->server_port != 7150 && data->client_port != 7150) return false; if (match_version_record(data->payload[0], data->payload_len[0])) { if (match_upgrade_resp(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_netmfp = { LPI_PROTO_NET_MFP, LPI_CATEGORY_WEB, "NET-MFP", 199, match_netmfp }; void register_netmfp(LPIModuleMap *mod_map) { register_protocol(&lpi_netmfp, mod_map); } ================================================ FILE: lib/tcp/lpi_nntp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_nntp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "mode")) return true; if (match_str_either(data, "MODE")) return true; if (match_str_either(data, "GROU")) return true; if (match_str_either(data, "grou")) return true; if (match_str_both(data, "AUTH", "200 ")) return true; if (match_str_both(data, "AUTH", "201 ")) return true; if (match_str_both(data, "AUTH", "200-")) return true; if (match_str_both(data, "AUTH", "201-")) return true; if (match_str_both(data, "auth", "200 ")) return true; if (match_str_both(data, "auth", "201 ")) return true; if (match_str_both(data, "auth", "200-")) return true; if (match_str_both(data, "auth", "201-")) return true; return false; } static lpi_module_t lpi_nntp = { LPI_PROTO_NNTP, LPI_CATEGORY_NEWS, "NNTP", 4, match_nntp }; void register_nntp(LPIModuleMap *mod_map) { register_protocol(&lpi_nntp, mod_map); } ================================================ FILE: lib/tcp/lpi_nntps.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_nntps(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This rule matches NNTP over SSL/TLS */ if (!match_ssl(data)) return false; /* NNTPS uses port 563 */ if (data->server_port != 563 && data->client_port != 563) return false; return true; } static lpi_module_t lpi_nntps = { LPI_PROTO_NNTPS, LPI_CATEGORY_NEWS, "NNTPS", 5, /* Should be a higher priority than regular SSL */ match_nntps }; void register_nntps(LPIModuleMap *mod_map) { register_protocol(&lpi_nntps, mod_map); } ================================================ FILE: lib/tcp/lpi_nofirstpkt.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" bool match_no_firstpkt(lpi_data_t *data, lpi_module_t *mod UNUSED) { if ( (data->observed[0] != 0 || data->observed[1] != 0) && (data->payload_len[0] == 0 && data->payload_len[1] == 0) ) return true; return false; } static lpi_module_t lpi_no_firstpkt = { LPI_PROTO_NO_FIRSTPKT, LPI_CATEGORY_NOPAYLOAD, "No_FirstPkt", 0, /* Must supercede all other protocols */ match_no_firstpkt }; void register_tcp_no_firstpkt(LPIModuleMap *mod_map) { register_protocol(&lpi_no_firstpkt, mod_map); } ================================================ FILE: lib/tcp/lpi_nomachine.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_nxd(uint32_t payload, uint32_t len) { if (len == 11 && MATCH(payload, 'N', 'X', 'D', '-')) return true; return false; } static inline bool match_nxup(uint32_t payload, uint32_t len) { if (len < 20 && MATCH(payload, 'N', 'X', 'U', 'P')) return true; return false; } static inline bool match_nomachine(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 4000? */ if (match_nxup(data->payload[0], data->payload_len[0])) { if (match_nxd(data->payload[1], data->payload_len[1])) { return true; } } if (match_nxd(data->payload[0], data->payload_len[0])) { if (match_nxup(data->payload[1], data->payload_len[1])) { return true; } } return false; } static lpi_module_t lpi_nomachine = { LPI_PROTO_NOMACHINE, LPI_CATEGORY_REMOTE, "NoMachine", 19, match_nomachine }; void register_nomachine(LPIModuleMap *mod_map) { register_protocol(&lpi_nomachine, mod_map); } ================================================ FILE: lib/tcp/lpi_nopayload.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" bool match_no_payload(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->observed[0] == 0 && data->observed[1] == 0) return true; return false; } static lpi_module_t lpi_no_payload = { LPI_PROTO_NO_PAYLOAD, LPI_CATEGORY_NOPAYLOAD, "No_Payload", 0, /* Must supercede all other protocols */ match_no_payload }; void register_tcp_no_payload(LPIModuleMap *mod_map) { register_protocol(&lpi_no_payload, mod_map); } ================================================ FILE: lib/tcp/lpi_norton_backup.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_nobu_rand(uint32_t payload, uint32_t len) { /* This seems to be a random host-specific ID? */ /* Rule out 00000000, as that is unlikely to be this */ if (MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return false; if (len == 4) return true; return false; } static inline bool match_nobu_zeroes(uint32_t payload, uint32_t len) { if (len != 4) return false; if (MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; if (MATCH(payload, 0x01, 0x00, 0x00, 0x00)) return true; if (MATCH(payload, 0x02, 0x00, 0x00, 0x00)) return true; if (MATCH(payload, 0x03, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_norton_backup(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 80 && data->client_port != 80) return false; /* Some sort of keep-alive protocol? Appears regularly on machines with * Norton backup active, but generally only sends 4 bytes each way. */ if (match_nobu_rand(data->payload[0], data->payload_len[0])) { if (match_nobu_zeroes(data->payload[1], data->payload_len[1])) return true; } if (match_nobu_rand(data->payload[1], data->payload_len[1])) { if (match_nobu_zeroes(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_norton_backup = { LPI_PROTO_NORTON_BACKUP, LPI_CATEGORY_CLOUD, "NortonBackup", 25, match_norton_backup }; void register_norton_backup(LPIModuleMap *mod_map) { register_protocol(&lpi_norton_backup, mod_map); } ================================================ FILE: lib/tcp/lpi_notes_rpc.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_notes_rpc(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Notes RPC is a proprietary protocol and I haven't been able to * find anything to confirm or disprove any of this. * * As a result, this rule is pretty iffy as it is based on a bunch * of flows observed going to 1 server using port 1352. There is * no documented basis for this (unlike most other rules) */ if (data->server_port != 1352 && data->client_port != 1352) return false; if (!match_str_either(data, "\x78\x00\x00\x00")) return false; if (MATCH(data->payload[0], ANY, ANY, 0x00, 0x00) && MATCH(data->payload[1], ANY, ANY, 0x00, 0x00)) return true; return false; } static lpi_module_t lpi_notes_rpc = { LPI_PROTO_NOTES_RPC, LPI_CATEGORY_REMOTE, "Lotus_Notes_RPC", 200, /* Don't really trust this rule that much :/ */ match_notes_rpc }; void register_notes_rpc(LPIModuleMap *mod_map) { register_protocol(&lpi_notes_rpc, mod_map); } ================================================ FILE: lib/tcp/lpi_nsq.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_nsq_v2(uint32_t payload, uint32_t len) { if (len == 4 && MATCH(payload, ' ', ' ', 'V', '2')) return true; return false; } static inline bool match_nsq_data(uint32_t payload, uint32_t len) { uint32_t assize = ntohl(payload); if (assize == len - 4) { return true; } return false; } static inline bool match_nsq(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 4150? */ if (match_nsq_v2(data->payload[0], data->payload_len[0])) { if (match_nsq_data(data->payload[1], data->payload_len[1])) return true; } if (match_nsq_v2(data->payload[1], data->payload_len[1])) { if (match_nsq_data(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_nsq = { LPI_PROTO_NSQ, LPI_CATEGORY_MESSAGE_QUEUE, "NSQ", 45, match_nsq }; void register_nsq(LPIModuleMap *mod_map) { register_protocol(&lpi_nsq, mod_map); } ================================================ FILE: lib/tcp/lpi_omegle.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* http://pastebin.com/bGxqigRN */ static inline bool match_omegle_client(uint32_t payload, uint32_t len) { if (len < 12) return false; if (!MATCH(payload, 0x0b, 'o', 'm', 'e')) return false; return true; } static inline bool match_omegle_server(uint32_t payload, uint32_t len) { if (len == 4 && MATCH(payload, 0x01, 'w', 0x00, 0x00)) return true; if (len == 68 && MATCH(payload, 0x01, 0x63, 0x00, 0x40)) return true; if (MATCH(payload, 0x09, 'c', 'l', 'i')) return true; return false; } static inline bool match_omegle(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_omegle_client(data->payload[0], data->payload_len[0])) { if (match_omegle_server(data->payload[1], data->payload_len[1])) return true; } if (match_omegle_client(data->payload[1], data->payload_len[1])) { if (match_omegle_server(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_omegle = { LPI_PROTO_OMEGLE, LPI_CATEGORY_CHAT, "Omegle", 3, match_omegle }; void register_omegle(LPIModuleMap *mod_map) { register_protocol(&lpi_omegle, mod_map); } ================================================ FILE: lib/tcp/lpi_openvpn.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_openvpn_handshake(uint32_t payload, uint32_t len) { uint16_t pktlen = ntohs((uint16_t)payload); /* First two bytes are the length of the packet (not including the * length) */ if (pktlen + 2 != len) return false; /* Handshake packets have opcodes of either 7 or 8 and key IDs of * zero, so the third byte is either 0x38 or 0x40 */ /* Ref: http://tinyurl.com/37tt3xe */ if (MATCH(payload, ANY, ANY, 0x38, ANY)) return true; if (MATCH(payload, ANY, ANY, 0x40, ANY)) return true; return false; } static inline bool match_openvpn(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_openvpn_handshake(data->payload[0], data->payload_len[0])) return false; if (!match_openvpn_handshake(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_openvpn = { LPI_PROTO_OPENVPN, LPI_CATEGORY_TUNNELLING, "OpenVPN", 4, /* Most of this rule is based on a length field in the header */ match_openvpn }; void register_openvpn(LPIModuleMap *mod_map) { register_protocol(&lpi_openvpn, mod_map); } ================================================ FILE: lib/tcp/lpi_ourworld.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* ourworld.com -- Flash-based MMO / game site combo thing */ static inline bool match_custom_flash_36(uint32_t payload, uint32_t len) { if (len == 36 && MATCH(payload, '<', 'm', '>', 'A')) return true; return false; } static inline bool match_custom_flash_200(uint32_t payload, uint32_t len) { if (MATCH(payload, '<', 'm', '>', 'A')) { if (len >= 200 && len <= 250) return true; } return false; } static inline bool match_ourworld(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 9310 */ if (match_custom_flash_36(data->payload[0], data->payload_len[0])) { if (match_custom_flash_200(data->payload[1], data->payload_len[1])) return true; } if (match_custom_flash_36(data->payload[1], data->payload_len[1])) { if (match_custom_flash_200(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_ourworld = { LPI_PROTO_OURWORLD, LPI_CATEGORY_GAMING, "OurWorld", 5, match_ourworld }; void register_ourworld(LPIModuleMap *mod_map) { register_protocol(&lpi_ourworld, mod_map); } ================================================ FILE: lib/tcp/lpi_palringo.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_palringo(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "AUTH", "LOGO")) return true; return false; } static lpi_module_t lpi_palringo = { LPI_PROTO_PALRINGO, LPI_CATEGORY_CHAT, "Palringo", 4, match_palringo }; void register_palringo(LPIModuleMap *mod_map) { register_protocol(&lpi_palringo, mod_map); } ================================================ FILE: lib/tcp/lpi_paltalk.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_pal_17f6(uint32_t payload, uint32_t len) { if (len != 8) return false; if (MATCH(payload, 0x17, 0xf6, 0x00, 0x01)) return true; return false; } static inline bool match_pal_24c2(uint32_t payload, uint32_t len) { if (len != 4) return false; if (MATCH(payload, 0x00, 0x00, 0x24, 0xc2)) return true; return false; } static inline bool match_pal_ff8b(uint32_t payload, uint32_t len) { if (len != 24) return false; if (MATCHSTR(payload, "\xff\x8b\x00\x0e")) return true; return false; } static inline bool match_pal_fb(uint32_t payload, uint32_t len) { if (len != 6) return false; if (MATCH(payload, 0xfb, ANY, 0x00, ANY)) return true; return false; } static inline bool match_pal_1byte(uint32_t payload, uint32_t len) { if (len != 0 and len != 1) return false; if (MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_pal_4byte(uint32_t payload, uint32_t len) { if (len != 4) return false; if (payload == 0) return false; if (MATCH(payload, 0x00, 0x00, ANY, ANY)) return true; return false; } static inline bool match_paltalk(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Created all these rules based on a capture of actual Paltalk * traffic */ if (match_pal_fb(data->payload[0], data->payload_len[0])) { if (match_pal_ff8b(data->payload[1], data->payload_len[1])) return true; } if (match_pal_fb(data->payload[1], data->payload_len[1])) { if (match_pal_ff8b(data->payload[0], data->payload_len[0])) return true; } if (match_pal_17f6(data->payload[0], data->payload_len[0])) { if (match_pal_24c2(data->payload[1], data->payload_len[1])) return true; } if (match_pal_17f6(data->payload[1], data->payload_len[1])) { if (match_pal_24c2(data->payload[0], data->payload_len[0])) return true; } /* These last two may be iffy, keep an eye out for false positives */ if (match_pal_4byte(data->payload[0], data->payload_len[0])) { if (match_pal_1byte(data->payload[1], data->payload_len[1])) return true; } if (match_pal_4byte(data->payload[1], data->payload_len[1])) { if (match_pal_1byte(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_paltalk = { LPI_PROTO_PALTALK, LPI_CATEGORY_CHAT, "Paltalk", 11, match_paltalk }; void register_paltalk(LPIModuleMap *mod_map) { register_protocol(&lpi_paltalk, mod_map); } ================================================ FILE: lib/tcp/lpi_pandatv.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_panda_request(uint32_t payload, uint32_t len) { /* Seen length 156 and 160 so far, so could be variable length */ if (MATCH(payload, 0x02, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_panda_reply(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x01, 0x00, 0x00, 0x00) && len == 36) return true; return false; } static inline bool match_pandatv(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 3105 && data->client_port != 3105) return false; if (match_panda_request(data->payload[0], data->payload_len[0])) { if (match_panda_reply(data->payload[1], data->payload_len[1])) return true; } if (match_panda_request(data->payload[1], data->payload_len[1])) { if (match_panda_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_pandatv = { LPI_PROTO_PANDATV, LPI_CATEGORY_STREAMING, "Panda.tv", 140, match_pandatv }; void register_pandatv(LPIModuleMap *mod_map) { register_protocol(&lpi_pandatv, mod_map); } ================================================ FILE: lib/tcp/lpi_pando.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_pando(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "\x0ePan")) return true; return false; } static lpi_module_t lpi_pando = { LPI_PROTO_PANDO, LPI_CATEGORY_P2P, "Pando", 3, match_pando }; void register_pando(LPIModuleMap *mod_map) { register_protocol(&lpi_pando, mod_map); } ================================================ FILE: lib/tcp/lpi_pathofexile.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_poe_40(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x00, 0x03, 0x00, 0x00)) { if (len == 40 || len == 54 || len == 20 || len == 66) { return true; } } return false; } static inline bool match_poe_05(uint32_t payload, uint32_t len) { if (len >= 200 && MATCH(payload, 0x00, 0x05, ANY, ANY)) return true; return false; } static inline bool match_pathofexile(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 6112 */ if (match_poe_40(data->payload[0], data->payload_len[0])) { if (match_poe_05(data->payload[1], data->payload_len[1])) return true; } if (match_poe_40(data->payload[1], data->payload_len[1])) { if (match_poe_05(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_pathofexile = { LPI_PROTO_PATHOFEXILE, LPI_CATEGORY_GAMING, "PathOfExile", 49, match_pathofexile }; void register_pathofexile(LPIModuleMap *mod_map) { register_protocol(&lpi_pathofexile, mod_map); } ================================================ FILE: lib/tcp/lpi_pdbox.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_pdbox(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "0127", "0326")) return true; return false; } static lpi_module_t lpi_pdbox = { LPI_PROTO_PDBOX, LPI_CATEGORY_CLOUD, "PDBOX", 3, match_pdbox }; void register_pdbox(LPIModuleMap *mod_map) { register_protocol(&lpi_pdbox, mod_map); } ================================================ FILE: lib/tcp/lpi_pop3.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_pop3(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_chars_either(data, '+', 'O', 'K', ANY)) return true; if (match_chars_either(data, '-', 'E', 'R', 'R')) return true; if (match_str_either(data, "CAPA")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } if (match_str_either(data, "AUTH")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } return false; } static lpi_module_t lpi_pop3 = { LPI_PROTO_POP3, LPI_CATEGORY_MAIL, "POP3", 2, match_pop3 }; void register_pop3(LPIModuleMap *mod_map) { register_protocol(&lpi_pop3, mod_map); } ================================================ FILE: lib/tcp/lpi_pop3s.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_pop3s(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_ssl(data)) return false; /* Assume all SSL traffic on port 995 is POP3S */ if (data->server_port == 995 || data->client_port == 995) return true; return false; } static lpi_module_t lpi_pop3s = { LPI_PROTO_POP3S, LPI_CATEGORY_MAIL, "POP3S", 2, /* Should be a higher priority than regular SSL */ match_pop3s }; void register_pop3s(LPIModuleMap *mod_map) { register_protocol(&lpi_pop3s, mod_map); } ================================================ FILE: lib/tcp/lpi_postgresql.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_postgresql(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Client start up messages start with a 4 byte length */ /* Server auth requests start with 'R', followed by 4 bytes of length * * All auth requests tend to be quite small */ if (ntohl(data->payload[0]) == data->payload_len[0]) { if (MATCH(data->payload[1], 0x52, 0x00, 0x00, 0x00)) return true; } if (ntohl(data->payload[1]) == data->payload_len[1]) { if (MATCH(data->payload[0], 0x52, 0x00, 0x00, 0x00)) return true; } return false; } static lpi_module_t lpi_postgresql = { LPI_PROTO_POSTGRESQL, LPI_CATEGORY_DATABASES, "Postgresql", 4, match_postgresql }; void register_postgresql(LPIModuleMap *mod_map) { register_protocol(&lpi_postgresql, mod_map); } ================================================ FILE: lib/tcp/lpi_pptp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_pptp_payload(uint32_t payload, uint32_t len) { if (len != 156) return false; if (!MATCH(payload, 0x00, 0x9c, 0x00, 0x01)) return false; return true; } static inline bool match_pptp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_pptp_payload(data->payload[0], data->payload_len[0])) return false; if (!match_pptp_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_pptp = { LPI_PROTO_PPTP, LPI_CATEGORY_TUNNELLING, "PPTP", 3, match_pptp }; void register_pptp(LPIModuleMap *mod_map) { register_protocol(&lpi_pptp, mod_map); } ================================================ FILE: lib/tcp/lpi_psn_store.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_psn_store(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This rule matches the SSL exchanges used by the Playstation * Store */ if (!match_ssl(data)) return false; /* All PSN SSL traffic is on port 5223 */ if (data->server_port != 5223 && data->client_port != 5223) return false; if (data->payload_len[0] == 66 && data->payload_len[1] == 1085) return true; if (data->payload_len[1] == 66 && data->payload_len[0] == 1085) return true; return false; } static lpi_module_t lpi_psn_store = { LPI_PROTO_PSN_STORE, LPI_CATEGORY_GAMING, "PSNStore", 2, /* Should be a higher priority than regular SSL */ match_psn_store }; void register_psn_store(LPIModuleMap *mod_map) { register_protocol(&lpi_psn_store, mod_map); } ================================================ FILE: lib/tcp/lpi_qcloud_ilvb.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Interactive Live Video Broadcasting, a service offered by Tencent QCloud. * * Seems to be some sort of SDK for developing live streaming applications. */ static inline bool match_qcloud_ilvb(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Packet sizes can vary -- 51,53,55,68 observed */ if (MATCH(data->payload[0], 0x28, 0x00, 0x00, 0x00)) { if (MATCH(data->payload[1], 0x28, 0x00, 0x00, 0x00)) return true; } return false; } static lpi_module_t lpi_qcloud_ilvb = { LPI_PROTO_QCLOUD_ILVB, LPI_CATEGORY_STREAMING, "QCloud_ILVB", 199, match_qcloud_ilvb }; void register_qcloud_ilvb(LPIModuleMap *mod_map) { register_protocol(&lpi_qcloud_ilvb, mod_map); } ================================================ FILE: lib/tcp/lpi_qq_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool check_length(uint32_t payload, uint32_t len) { uint32_t swap; uint32_t length; if (!(MATCH(payload, ANY, ANY, 0x02, ANY) || MATCH(payload, ANY, ANY, 0x2d, ANY))) return false; swap=ntohl(payload); length = swap >> 16; if (length != len) return false; return true; } static inline bool match_qq_8080(uint32_t payload, uint32_t len) { if (len == 0) return false; if (ntohl(payload) == len) return true; return false; } static inline bool match_qq_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port == 8080 || data->client_port == 8080) { /* Typically traffic to msfwifi.3g.qq.com, only seen on * mobile QQ clients. */ if (match_qq_8080(data->payload[0], data->payload_len[0])) { if (match_qq_8080(data->payload[1], data->payload_len[1])) return true; } } if (data->payload_len[0] == 0 || data->payload_len[1] == 0) return false; if ((data->payload[0] & 0xffff0000) != (data->payload[1] & 0xffff0000)) return false; if ((data->payload[0] & 0xffff0000) == 0x00000000) return false; if ((data->payload[1] & 0xffff0000) == 0x00000000) return false; if (!check_length(data->payload[0], data->payload_len[0])) return false; if (!check_length(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_qq_tcp = { LPI_PROTO_QQ, LPI_CATEGORY_CHAT, "QQ", 20, match_qq_tcp }; void register_qq_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_qq_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_qqdownload.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_qqd_req(uint32_t payload) { if (!MATCH(payload, 0x02, 0x03, ANY, ANY)) return false; if (MATCH(payload, 0x02, 0x03, 0x05, 0x00)) return true; if (MATCH(payload, 0x02, 0x03, 0x05, 0x01)) return true; if (MATCH(payload, 0x02, 0x03, 0x04, 0x00)) return true; if (MATCH(payload, 0x02, 0x03, 0x04, 0x01)) return true; if (MATCH(payload, 0x02, 0x03, 0x04, 0x03)) return true; if (MATCH(payload, 0x02, 0x03, 0x04, 0x06)) return true; return false; } static inline bool match_qqd_resp(uint32_t payload) { if (MATCH(payload, 0x02, 0x03, 0x04, 0x00)) return true; if (MATCH(payload, 0x02, 0x03, 0x04, 0x04)) return true; if (MATCH(payload, 0x02, 0x03, 0x04, 0x05)) return true; if (MATCH(payload, 0x02, 0x03, 0x04, 0x13)) return true; if (MATCH(payload, 0x02, 0x03, 0x04, 0x17)) return true; if (MATCH(payload, 0x02, 0x03, 0x05, 0x00)) return true; if (MATCH(payload, 0x02, 0x03, 0x05, 0x01)) return true; return false; } static inline bool match_qqdownload(lpi_data_t *data, lpi_module_t *mod UNUSED) { if ((data->payload[0] & 0xffffff) != (data->payload[1] & 0xffffff)) return false; if (match_qqd_req(data->payload[0])) { if (match_qqd_resp(data->payload[1])) return true; } if (match_qqd_req(data->payload[1])) { if (match_qqd_resp(data->payload[0])) return true; } return false; } static lpi_module_t lpi_qqdownload = { LPI_PROTO_QQDOWNLOAD, LPI_CATEGORY_P2P, "QQDownload", 14, match_qqdownload }; void register_qqdownload(LPIModuleMap *mod_map) { register_protocol(&lpi_qqdownload, mod_map); } ================================================ FILE: lib/tcp/lpi_qqlive_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_qqlive_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->payload_len[0] == 0 || data->payload_len[1] == 0) { if (data->server_port == 53 || data->client_port == 53) return false; } if (!match_qqlive_payload(data->payload[0], data->payload_len[0])) return false; if (!match_qqlive_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_qqlive_tcp = { LPI_PROTO_QQLIVE, LPI_CATEGORY_P2PTV, "QQLive_TCP", 4, match_qqlive_tcp }; void register_qqlive_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_qqlive_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_qqspeedmobile_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_speedtcp_113(uint32_t payload, uint32_t len) { if (len == 113 && MATCH(payload, 0x33, 0x66, 0x00, 0x08)) return true; return false; } static inline bool match_speedtcp_212(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x33, 0x66, 0x00, 0x08)) { if (len == 212 || len == 216) return true; } return false; } static inline bool match_qqspeedmobile_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_speedtcp_113(data->payload[0], data->payload_len[0])) { if (match_speedtcp_212(data->payload[1], data->payload_len[1])) return true; } if (match_speedtcp_113(data->payload[1], data->payload_len[1])) { if (match_speedtcp_212(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_qqspeedmobile_tcp = { LPI_PROTO_QQSPEEDMOBILE, LPI_CATEGORY_GAMING, "QQSpeedMobile_TCP", 5, match_qqspeedmobile_tcp }; void register_qqspeedmobile_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_qqspeedmobile_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_qvod.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Chinese variant of BitTorrent -- www.qvod.com */ static inline bool match_qvod_message(uint32_t payload, uint32_t len) { if (!MATCH(payload, 0x13, 'Q', 'V', 'O')) return false; return true; } static inline bool match_qvod(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_qvod_message(data->payload[0], data->payload_len[0])) { if (match_qvod_message(data->payload[1], data->payload_len[1])) return true; if (data->payload_len[1] == 0) return true; } if (match_qvod_message(data->payload[1], data->payload_len[1])) { if (match_qvod_message(data->payload[0], data->payload_len[0])) return true; if (data->payload_len[0] == 0) return true; } return false; } static lpi_module_t lpi_qvod = { LPI_PROTO_QVOD, LPI_CATEGORY_P2P, "Qvod", 6, match_qvod }; void register_qvod(LPIModuleMap *mod_map) { register_protocol(&lpi_qvod, mod_map); } ================================================ FILE: lib/tcp/lpi_rabbitmq.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_amqp_header(uint32_t payload, uint32_t len) { if (len == 8 && MATCH(payload, 'A', 'M', 'Q', 'P')) { return true; } return false; } static inline bool match_amqp_start(uint32_t payload) { /* only seen length 498 so far, but surely this could vary more */ if (MATCH(payload, 0x01, 0x00, 0x00, 0x00)) { return true; } return false; } static inline bool match_rabbitmq(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 5672 && data->client_port != 5672) { return false; } if (match_amqp_header(data->payload[0], data->payload_len[0])) { if (match_amqp_start(data->payload[1])) { return true; } } if (match_amqp_header(data->payload[1], data->payload_len[1])) { if (match_amqp_start(data->payload[0])) { return true; } } return false; } static lpi_module_t lpi_rabbitmq = { LPI_PROTO_RABBITMQ, LPI_CATEGORY_MESSAGE_QUEUE, "RabbitMQ", 75, match_rabbitmq }; void register_rabbitmq(LPIModuleMap *mod_map) { register_protocol(&lpi_rabbitmq, mod_map); } ================================================ FILE: lib/tcp/lpi_ragnarokonline.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ro_0204(uint32_t payload, uint32_t len) { if (len < 11) { return false; } if (MATCH(payload, 0x02, 0x04, 0x00, 0x21)) { return true; } return false; } static inline bool match_ro_reply(uint32_t payload, uint32_t len) { if (len == 53 && MATCH(payload, 0x00, 0x32, 0x00, 0x01)) { return true; } if (len == 57 && MATCH(payload, 0x00, 0x36, 0x00, 0x01)) { return true; } return false; } static inline bool match_ragnarokonline(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 5222 && data->client_port != 5222) { return false; } if (match_ro_0204(data->payload[0], data->payload_len[0])) { if (match_ro_reply(data->payload[1], data->payload_len[1])) { return true; } } if (match_ro_0204(data->payload[1], data->payload_len[1])) { if (match_ro_reply(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_ragnarokonline = { LPI_PROTO_RAGNAROK_ONLINE, LPI_CATEGORY_GAMING, "RagnarokOnline", 80, match_ragnarokonline }; void register_ragnarokonline(LPIModuleMap *mod_map) { register_protocol(&lpi_ragnarokonline, mod_map); } ================================================ FILE: lib/tcp/lpi_razor.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Razor server contacts (ie SpamAssassin) */ static inline bool match_razor(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_chars_either(data, 's', 'n', '=', ANY)) return true; return false; } static lpi_module_t lpi_razor = { LPI_PROTO_RAZOR, LPI_CATEGORY_ANTISPAM, "Razor", 2, match_razor }; void register_razor(LPIModuleMap *mod_map) { register_protocol(&lpi_razor, mod_map); } ================================================ FILE: lib/tcp/lpi_rbls.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_rbls(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "rbls")) return true; return false; } static lpi_module_t lpi_rbls = { LPI_PROTO_RBLS, LPI_CATEGORY_ANTISPAM, "RBL", 3, match_rbls }; void register_rbls(LPIModuleMap *mod_map) { register_protocol(&lpi_rbls, mod_map); } ================================================ FILE: lib/tcp/lpi_rdp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_rdp_sizes(lpi_data_t *data) { /* This should match the common packet sizes we see for genuine * RDP traffic */ if (data->payload_len[0] == 11 || data->payload_len[0] == 19) { if (data->payload_len[1] == 19) return true; if (data->payload_len[1] >= 30 && data->payload_len[1] <= 47) return true; } if (data->payload_len[1] == 11 || data->payload_len[1] == 19) { if (data->payload_len[0] == 19) return true; if (data->payload_len[0] >= 30 && data->payload_len[0] <= 47) return true; } return false; } static inline bool match_rdp_port(lpi_data_t *data) { /* To try and avoid confusing RDP with other protocols that rely * on TPKT, most notably H.323, I've had to add a port requirement * here */ if (data->server_port == 3389 || data->client_port == 3389) return true; return false; } static bool match_rdp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* RDP is transported via TPKT */ if (!match_tpkt(data->payload[0], data->payload_len[0])) return false; if (!match_tpkt(data->payload[1], data->payload_len[1])) return false; if (match_rdp_port(data)) return true; if (match_rdp_sizes(data)) return true; #if 0 if (match_tpkt(data->payload[0], data->payload_len[0])) { if (match_tpkt(data->payload[1], data->payload_len[1])) return true; /* Some RDP responses seem to be encrypted - not sure if this * payload length is common to all flows */ if (data->payload_len[1] == 309) return true; } if (match_tpkt(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] == 309) return true; } #endif return false; } static lpi_module_t lpi_rdp = { LPI_PROTO_RDP, LPI_CATEGORY_REMOTE, "RDP", 4, /* Moving this to 4 purely on gut feeling */ match_rdp }; void register_rdp(LPIModuleMap *mod_map) { register_protocol(&lpi_rdp, mod_map); } ================================================ FILE: lib/tcp/lpi_realmofthemadgod.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_rotmg_small(uint32_t payload, uint32_t len) { if (ntohl(payload) == len && len < 100) return true; return false; } static inline bool match_rotmg_big(uint32_t payload, uint32_t len) { if (ntohl(payload) == len && len > 400 && len < 520) return true; return false; } static inline bool match_realmofthemadgod(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 2050 && data->client_port != 2050) { return false; } if (match_rotmg_small(data->payload[0], data->payload_len[0])) { if (match_rotmg_big(data->payload[1], data->payload_len[1])) return true; } if (match_rotmg_small(data->payload[1], data->payload_len[1])) { if (match_rotmg_big(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_realmofthemadgod = { LPI_PROTO_REALMOFTHEMADGOD, LPI_CATEGORY_GAMING, "RealmOfTheMadGod", 239, match_realmofthemadgod }; void register_realmofthemadgod(LPIModuleMap *mod_map) { register_protocol(&lpi_realmofthemadgod, mod_map); } ================================================ FILE: lib/tcp/lpi_realvnc.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_real(uint32_t payload) { if (MATCH(payload, 'R', 'E', 'A', 'L')) return true; return false; } static inline bool match_real_resp(uint32_t payload, uint32_t len) { /* Byte 3 could be a length field (len - 3). */ if (MATCH(payload, 0x81, 0x00, 0x14, ANY) && len == 23) return true; return false; } static inline bool match_realvnc(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_real(data->payload[0])) { if (match_real_resp(data->payload[1], data->payload_len[1])) return true; } if (match_real(data->payload[1])) { if (match_real_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_realvnc = { LPI_PROTO_REALVNC, LPI_CATEGORY_REMOTE, "RealVNC", 10, match_realvnc }; void register_realvnc(LPIModuleMap *mod_map) { register_protocol(&lpi_realvnc, mod_map); } ================================================ FILE: lib/tcp/lpi_rejection.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_rejection(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This is an odd one - the server allows a TCP handshake to complete, * but responds to any requests with a single 0x02 byte. Not sure * whether this is some kind of honeypot or what. * * We see this behaviour on ports 445, 1433 and 80, if we need * further checking */ if (MATCH(data->payload[0], 0x02, 0x00, 0x00, 0x00)) { if (data->payload_len[0] == 1) return true; } if (MATCH(data->payload[1], 0x02, 0x00, 0x00, 0x00)) { if (data->payload_len[1] == 1) return true; } return false; } static lpi_module_t lpi_rejection = { LPI_PROTO_REJECTION, LPI_CATEGORY_NO_CATEGORY, "Rejection", 255, /* This one must be dead last */ match_rejection }; void register_rejection(LPIModuleMap *mod_map) { register_protocol(&lpi_rejection, mod_map); } ================================================ FILE: lib/tcp/lpi_relay.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* https://docs.syncthing.net/specs/relay-v1.html */ static inline bool match_relay_magic(uint32_t payload) { if (MATCH(payload, 0x9e, 0x79, 0xbc, 0x40)) return true; return false; } static inline bool match_relay(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_relay_magic(data->payload[0])) { if (match_relay_magic(data->payload[1])) return true; } return false; } static lpi_module_t lpi_relay = { LPI_PROTO_RELAY, LPI_CATEGORY_NAT, "Relay", 5, match_relay }; void register_relay(LPIModuleMap *mod_map) { register_protocol(&lpi_relay, mod_map); } ================================================ FILE: lib/tcp/lpi_remote_manipulator.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Remote Manipulator System a.k.a Remote Utilities * * Russian RDP-style software, sometimes used in malware for remote control. */ static inline bool match_rms_9504(uint32_t payload, uint32_t len) { if (len == 1338 && MATCH(payload, 0x95, 0x04, 0x00, 0x00)) { return true; } return false; } static inline bool match_rms_d90d(uint32_t payload, uint32_t len) { if (len == 8 && MATCH(payload, 0xd9, 0x0d, 0x00, 0x00)) { return true; } return false; } static inline bool match_remote_manipulator(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 5655 && data->client_port != 5655) return false; if (match_rms_9504(data->payload[0], data->payload_len[0])) { if (match_rms_d90d(data->payload[1], data->payload_len[1])) { return true; } } if (match_rms_9504(data->payload[1], data->payload_len[1])) { if (match_rms_d90d(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_remote_manipulator = { LPI_PROTO_REMOTE_MANIPULATOR, LPI_CATEGORY_REMOTE, "RemoteManipulator", 100, match_remote_manipulator }; void register_remote_manipulator(LPIModuleMap *mod_map) { register_protocol(&lpi_remote_manipulator, mod_map); } ================================================ FILE: lib/tcp/lpi_revolver_nblbt.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* This appears to be some sort of Chinese P2P game updating software from * Revolver Software (?). * * This is based on the appearance of the strings "nblbt" and "nbmep" in * the payload of the initial packets. NBLBT.rar and NBMEP.rar can be * downloaded from www.zy995.com which seems to host numerous offerings from * Revolver Software. * * Yet to fully confirm as a) I don't know enough Chinese to install and run * the software sensibly and b) I strongly suspect the software is bundled * with all sorts of malware so am reluctant to install it anywhere that isn't * a completely fenced-off sandbox. */ static inline bool match_nblbt_ok(uint32_t payload, uint32_t len) { if (len != 20) return false; if (!MATCH(payload, 'o', 'k', 0x00, 0x00)) return false; return true; } static inline bool match_nblbt_reply(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len != 1024) return false; if (!MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return false; return true; } static inline bool match_revolver_nblbt(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_nblbt_ok(data->payload[0], data->payload_len[0])) { if (match_nblbt_reply(data->payload[1], data->payload_len[1])) return true; } if (match_nblbt_ok(data->payload[1], data->payload_len[1])) { if (match_nblbt_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_revolver_nblbt = { LPI_PROTO_REVOLVER_NBLBT, LPI_CATEGORY_P2P, "RevolverNBLBT", 6, match_revolver_nblbt }; void register_revolver_nblbt(LPIModuleMap *mod_map) { register_protocol(&lpi_revolver_nblbt, mod_map); } ================================================ FILE: lib/tcp/lpi_rfb.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_rfb(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "RFB ")) return true; return false; } static lpi_module_t lpi_rfb = { LPI_PROTO_RFB, LPI_CATEGORY_REMOTE, "RFB", 3, match_rfb }; void register_rfb(LPIModuleMap *mod_map) { register_protocol(&lpi_rfb, mod_map); } ================================================ FILE: lib/tcp/lpi_rpcscan.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_rpcscan(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* RPC Exploit */ if (match_chars_either(data, 0x05, 0x00, 0x0b, 0x03)) return true; return false; } static lpi_module_t lpi_rpcscan = { LPI_PROTO_RPC_SCAN, LPI_CATEGORY_MALWARE, "RPC_Exploit", 8, /* Most malware can go to priority 8 - want to match legit protocols * first */ match_rpcscan }; void register_rpcscan(LPIModuleMap *mod_map) { register_protocol(&lpi_rpcscan, mod_map); } ================================================ FILE: lib/tcp/lpi_rrtv.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* rr.tv -- P2P TV/video streaming from China */ /* XXX mobile only, need to test the app properly but the initial * packets literally include URLs referring to rr.tv so I'm pretty * confident. */ static inline bool match_rrtv_header(uint32_t payload, uint32_t len) { /* broad estimate based on what I've seen so far */ if (len < 380 || len > 900) { return false; } if ((ntohl(payload) & 0x0000ffff) != len - 4) { return false; } if (MATCH(payload, 0x01, 0x10, ANY, ANY)) { return true; } return false; } static inline bool match_rrtv(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_rrtv_header(data->payload[0], data->payload_len[0])) { if (match_rrtv_header(data->payload[1], data->payload_len[1])) { return true; } } return false; } static lpi_module_t lpi_rrtv = { LPI_PROTO_RRTV, LPI_CATEGORY_P2PTV, "RR.tv", 120, match_rrtv }; void register_rrtv(LPIModuleMap *mod_map) { register_protocol(&lpi_rrtv, mod_map); } ================================================ FILE: lib/tcp/lpi_rsync.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_rsync(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "@RSY")) return true; return false; } static lpi_module_t lpi_rsync = { LPI_PROTO_RSYNC, LPI_CATEGORY_FILES, "Rsync", 3, match_rsync }; void register_rsync(LPIModuleMap *mod_map) { register_protocol(&lpi_rsync, mod_map); } ================================================ FILE: lib/tcp/lpi_rtmp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_rtmp_server_handshake(uint32_t payload, uint32_t len, bool defaultport) { if (len < 4 && !defaultport) return false; /* Standard RTMP handshake types */ if (MATCH(payload, 0x03, ANY, ANY, ANY)) return true; if (MATCH(payload, 0x06, ANY, ANY, ANY)) return true; /* Encrypted, but not RTMPE? */ if (MATCH(payload, 0x08, ANY, ANY, ANY)) return true; /* RTMPE handshake type */ if (MATCH(payload, 0x09, ANY, ANY, ANY)) return true; /* New handshake type used by some YouTube videos */ if (MATCH(payload, 0x0a, ANY, ANY, ANY)) return true; return false; } static inline bool match_rtmp_client_handshake(uint32_t payload, uint32_t len) { if (len < 4) return false; /* Standard RTMP handshake types */ if (MATCH(payload, 0x03, ANY, ANY, ANY)) return true; if (MATCH(payload, 0x06, ANY, ANY, ANY)) return true; return false; } static inline bool match_rtmp(lpi_data_t *data, lpi_module_t *mod UNUSED) { bool defaultport = false; if (data->server_port == 1935 || data->client_port == 1935) defaultport = true; /* Facebook live streaming wants to use port 80 sometimes and they * love sending 1 byte handshakes :( */ if (data->server_port == 80 || data->client_port == 80) defaultport = true; if (match_rtmp_client_handshake(data->payload[0], data->payload_len[0])) { if (match_rtmp_server_handshake(data->payload[1], data->payload_len[1], defaultport)) { return true; } } if (match_rtmp_client_handshake(data->payload[1], data->payload_len[1])) { if (match_rtmp_server_handshake(data->payload[0], data->payload_len[0], defaultport)) { return true; } } return false; } static lpi_module_t lpi_rtmp = { LPI_PROTO_RTMP, LPI_CATEGORY_STREAMING, "RTMP", 169, /* Not a strong rule */ match_rtmp }; void register_rtmp(LPIModuleMap *mod_map) { register_protocol(&lpi_rtmp, mod_map); } ================================================ FILE: lib/tcp/lpi_rtsp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_rtsp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "RTSP")) return true; return false; } static lpi_module_t lpi_rtsp = { LPI_PROTO_RTSP, LPI_CATEGORY_STREAMING, "RTSP", 2, match_rtsp }; void register_rtsp(LPIModuleMap *mod_map) { register_protocol(&lpi_rtsp, mod_map); } ================================================ FILE: lib/tcp/lpi_runescape.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Protocol is not documented and goes through all sorts of revisions * (mainly to stop hax0rs, no doubt) - so this is mostly based on * observations of traffic to Jagex servers and messing around with the * game myself */ static inline bool match_runescape_req(uint32_t payload, uint32_t len) { if (len == 1 || len == 105) { if (MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; } if (len == 9 && MATCH(payload, 0x00, ANY, ANY, ANY)) return true; return false; } static inline bool match_runescape_resp(uint32_t payload, uint32_t len) { /* Don't allow empty responses, as the request rule is rather * non-specific */ /* First byte appears to be a packet type * Second bytes is the packet length - 2 * * It appears many types have a fixed size anyway, so no need to * get fancy :) */ if (MATCH(payload, 0x0f, 0x29, 0x00, 0x00)) { if (len == 43) return true; } if (MATCH(payload, 0x0f, 0x2a, 0x00, 0x00)) { if (len == 44) return true; } if (MATCH(payload, 0x0e, 0x00, 0x00, 0x00)) { if (len == 1) return true; } if (MATCH(payload, 0x0f, 0x00, 0x00, 0x00)) { if (len == 1) return true; if (len == 5) return true; } return false; } static inline bool match_runescape(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_runescape_req(data->payload[0], data->payload_len[0])) { if (match_runescape_resp(data->payload[1], data->payload_len[1])) { return true; } } if (match_runescape_req(data->payload[1], data->payload_len[1])) { if (match_runescape_resp(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_runescape = { LPI_PROTO_RUNESCAPE, LPI_CATEGORY_GAMING, "Runescape", 9, match_runescape }; void register_runescape(LPIModuleMap *mod_map) { register_protocol(&lpi_runescape, mod_map); } ================================================ FILE: lib/tcp/lpi_s7comm.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_s7comm_sizes(lpi_data_t *data) { /* Based on observations, size of first package is equal * in both directions. */ if (data->payload_len[0] == data->payload_len[1]) { return true; } return false; } static inline bool match_s7comm_port(lpi_data_t *data) { if (data->server_port == 102 || data->client_port == 102) { return true; } return false; } static bool match_s7comm(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* S7COMM uses port 102 */ if (!match_s7comm_port(data)) return false; /* S7COMM is transported via TPKT */ if (!match_tpkt(data->payload[0], data->payload_len[0])) return false; if (!match_tpkt(data->payload[1], data->payload_len[1])) return false; if (match_s7comm_sizes(data)) return true; return false; } static lpi_module_t lpi_s7comm = { LPI_PROTO_S7COMM, LPI_CATEGORY_ICS, "S7COMM", 7, /* Must come before TPKT */ match_s7comm }; void register_s7comm(LPIModuleMap *mod_map) { register_protocol(&lpi_s7comm, mod_map); } ================================================ FILE: lib/tcp/lpi_saprouter.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_nipong(uint32_t payload, uint32_t len) { /* A NI_PONG message should always have the same structure... */ if (len == 12 && MATCH(payload, 0x00, 0x00, 0x00, 0x08)) return true; return false; } static inline bool match_saprouter(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 3299 && data->client_port != 3299) return false; /* Not very distinctive, so we need the port restriction as well */ if (ntohl(data->payload[0]) == data->payload_len[0] - 4) { if (match_nipong(data->payload[1], data->payload_len[1])) return true; } if (ntohl(data->payload[1]) == data->payload_len[1] - 4) { if (match_nipong(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_saprouter = { LPI_PROTO_SAPROUTER, LPI_CATEGORY_SERVICES, "SAPRouter", 251, match_saprouter }; void register_saprouter(LPIModuleMap *mod_map) { register_protocol(&lpi_saprouter, mod_map); } ================================================ FILE: lib/tcp/lpi_saszombieassault4.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_saszombieassault4(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 1445 */ if (MATCHSTR(data->payload[0], "NKMl")) { if (MATCHSTR(data->payload[1], "NKMl")) return true; } return false; } static lpi_module_t lpi_saszombieassault4 = { LPI_PROTO_SAS_ZOMBIE_ASSAULT_4, LPI_CATEGORY_GAMING, "SASZombieAssault4", 5, match_saszombieassault4 }; void register_saszombieassault4(LPIModuleMap *mod_map) { register_protocol(&lpi_saszombieassault4, mod_map); } ================================================ FILE: lib/tcp/lpi_second_life.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_second_life(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* SecondLife uses SSL over port 12043 and HTTP over port 12046 */ if (data->server_port == 12043 || data->client_port == 12043) { if (match_ssl(data)) return true; } if (data->server_port == 12046 || data->client_port == 12046) { if (match_str_both(data, "GET ", "HTTP")) return true; if (match_str_either(data, "GET ")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } } return false; } static lpi_module_t lpi_second_life = { LPI_PROTO_SECONDLIFE, LPI_CATEGORY_GAMING, "SecondLife", 6, match_second_life }; void register_second_life(LPIModuleMap *mod_map) { register_protocol(&lpi_second_life, mod_map); } ================================================ FILE: lib/tcp/lpi_shoutcast.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_shoutcast(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "GET ", "ICY ")) return true; if (match_chars_either(data, 'O', 'K', '2', 0x0d)) return true; if (match_chars_either(data, 'I', 'C', 'Y', ' ')) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } return false; } static lpi_module_t lpi_shoutcast = { LPI_PROTO_SHOUTCAST, LPI_CATEGORY_STREAMING, "Shoutcast", 1, /* Should be ahead of HTTP, due to "GET" */ match_shoutcast }; void register_shoutcast(LPIModuleMap *mod_map) { register_protocol(&lpi_shoutcast, mod_map); } ================================================ FILE: lib/tcp/lpi_silkroadonline.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_sro_req(uint32_t payload, uint32_t len) { if (len != 18) return false; if (MATCH(payload, 0x0c, 0x00, 0x00, 0x50)) return true; return false; } static inline bool match_sro_resp(uint32_t payload, uint32_t len) { if (len != 43) return false; if (MATCH(payload, 0x25, 0x00, 0x00, 0x50)) return true; return false; } static inline bool match_silkroadonline(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Uses ports 15884 and 15779, also server is located at * hyperfilter.com. */ if (match_sro_req(data->payload[0], data->payload_len[0])) { if (match_sro_resp(data->payload[1], data->payload_len[1])) return true; } if (match_sro_req(data->payload[1], data->payload_len[1])) { if (match_sro_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_silkroadonline = { LPI_PROTO_SILKROADONLINE, LPI_CATEGORY_GAMING, "SilkRoadOnline", 5, match_silkroadonline }; void register_silkroadonline(LPIModuleMap *mod_map) { register_protocol(&lpi_silkroadonline, mod_map); } ================================================ FILE: lib/tcp/lpi_sip.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_sip(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "SIP/", "REGI")) return true; /* Non-RFC SIP added by Donald Neal, June 2008 */ if (match_str_either(data, "SIP-")) { if (match_chars_either(data, 'R', ' ', ANY, ANY)) return true; } if (match_str_either(data, "REGI") && (data->payload_len[0] == 0 || data->payload_len[1] == 0)) return true; return false; } static lpi_module_t lpi_sip = { LPI_PROTO_SIP, LPI_CATEGORY_VOIP, "SIP", 2, match_sip }; void register_sip(LPIModuleMap *mod_map) { register_protocol(&lpi_sip, mod_map); } ================================================ FILE: lib/tcp/lpi_skyforge.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_sf_req(uint32_t payload, uint32_t len) { if (len == 168 && MATCH(payload, 0xa6, 0x00, 0xef, 0x03)) { return true; } return false; } static inline bool match_sf_reply(uint32_t payload, uint32_t len) { if (len == 10 && MATCH(payload, 0x08, 0x00, 0xef, 0x82)) { return true; } return false; } static inline bool match_skyforge(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_sf_req(data->payload[0], data->payload_len[0])) { if (match_sf_reply(data->payload[1], data->payload_len[1])) { return true; } } if (match_sf_req(data->payload[1], data->payload_len[1])) { if (match_sf_reply(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_skyforge = { LPI_PROTO_SKYFORGE, LPI_CATEGORY_GAMING, "Skyforge", 5, match_skyforge }; void register_skyforge(LPIModuleMap *mod_map) { register_protocol(&lpi_skyforge, mod_map); } ================================================ FILE: lib/tcp/lpi_skype_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_skype_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This rule matches SSL traffic sent by Skype clients * * It isn't clear what the TCP session is used for, though... */ if (!match_ssl(data)) return false; /* Ports 12350 and 13392 are used for these sessions */ if (data->server_port != 12350 && data->client_port != 12350 && data->server_port != 13392 && data->client_port != 13392) return false; /* Other payload sizes are possible unfortunately, but rare */ if (data->payload_len[0] == 5 || data->payload_len[0] == 92 || data->payload_len[0] == 89 || data->payload_len[0] == 90 || data->payload_len[0] == 33) return true; if (data->payload_len[1] == 5 || data->payload_len[1] == 92 || data->payload_len[1] == 89 || data->payload_len[1] == 90 || data->payload_len[1] == 33) return true; return false; } static lpi_module_t lpi_skype_tcp = { LPI_PROTO_SKYPE_TCP, LPI_CATEGORY_VOIP, "SkypeTCP", 20, /* Should be a higher priority than regular SSL */ match_skype_tcp }; void register_skype_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_skype_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_smb.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_smb_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (match_payload_length(payload, len)) return true; /* Some stupid systems send the NetBIOS header separately, which * makes this a lot harder to detect :( * * Instead, look for common payload sizes. */ if (MATCH(payload, 0x00, 0x00, 0x00, 0x85)) return true; /* Also, sometimes we just forget the NetBIOS header, or the * connection fails before it is retransmitted */ if (MATCH(payload, 0xff, 'S', 'M', 'B')) return true; return false; } static inline bool match_smb(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* SMB is often prepended with a NetBIOS session service header. * It's easiest for us to treat it as a four byte length field (it * is actually a bit more complicated than that, but all other fields * tend to be zero anyway) * * More details at http://lists.samba.org/archive/samba-technical/2003-January/026283.html */ /* Only match on port 445 to avoid clashing with other 4 byte length * fields */ if (data->server_port != 445 && data->client_port != 445) return false; if (!match_smb_payload(data->payload[0], data->payload_len[0])) return false; if (!match_smb_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_smb = { LPI_PROTO_SMB, LPI_CATEGORY_FILES, "SMB", 3, match_smb }; void register_smb(LPIModuleMap *mod_map) { register_protocol(&lpi_smb, mod_map); } ================================================ FILE: lib/tcp/lpi_smite_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_smite_magic(uint32_t payload, uint32_t len) { if (len < 100 && MATCH(payload, 0x78, 0xdb, 0x39, 0x64)) return true; return false; } static inline bool match_smite_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_smite_magic(data->payload[0], data->payload_len[0])) { if (match_smite_magic(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_smite_tcp = { LPI_PROTO_SMITE, LPI_CATEGORY_GAMING, "SmiteTCP", 55, match_smite_tcp }; void register_smite_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_smite_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_smtp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_smtp_command(uint32_t payload, uint32_t len) { if (MATCHSTR(payload, "EHLO")) return true; if (MATCHSTR(payload, "ehlo")) return true; if (MATCHSTR(payload, "HELO")) return true; if (MATCHSTR(payload, "helo")) return true; if (MATCHSTR(payload, "NOOP")) return true; if (MATCHSTR(payload, "XXXX")) return true; if (MATCHSTR(payload, "HELP")) return true; if (MATCHSTR(payload, "EXPN")) return true; /* Turns out there are idiots who send their ehlos one byte at a * time :/ */ if (MATCH(payload, 'e', 0x00, 0x00, 0x00) && len == 1) return true; if (MATCH(payload, 'E', 0x00, 0x00, 0x00) && len == 1) return true; if (MATCH(payload, 'h', 0x00, 0x00, 0x00) && len == 1) return true; if (MATCH(payload, 'H', 0x00, 0x00, 0x00) && len == 1) return true; return false; } static inline bool match_smtp_banner(uint32_t payload, uint32_t len) { /* Stupid servers that only send the banner one or two bytes at * a time! */ if (len == 1) { if (MATCH(payload, '2', 0x00, 0x00, 0x00)) return true; return false; } if (len == 2) { if (MATCH(payload, '2', '2', 0x00, 0x00)) return true; return false; } if (len == 3) { if (MATCH(payload, '2', '2', '0', 0x00)) return true; return false; } if (MATCH(payload, '2', '2', '0', ' ')) return true; if (MATCH(payload, '2', '2', '0', '-')) return true; return false; } static inline bool match_smtp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Match all the random error codes */ if (data->payload_len[0] == 0 || data->payload_len[1] == 0) { if (match_str_either(data, "220 ")) return true; if (match_str_either(data, "450 ")) return true; if (match_str_either(data, "550 ")) return true; if (match_str_either(data, "550-")) return true; if (match_str_either(data, "421 ")) return true; if (match_str_either(data, "421-")) return true; if (match_str_either(data, "451 ")) return true; if (match_str_either(data, "451-")) return true; if (match_str_either(data, "452 ")) return true; if (match_str_either(data, "420 ")) return true; if (match_str_either(data, "571 ")) return true; if (match_str_either(data, "553 ")) return true; if (match_str_either(data, "554 ")) return true; if (match_str_either(data, "554-")) return true; if (match_str_either(data, "476 ")) return true; if (match_str_either(data, "475 ")) return true; } if (match_str_either(data, "QUIT") && (data->server_port == 25 || data->client_port == 25)) return true; if (match_str_either(data, "quit") && (data->server_port == 25 || data->client_port == 25)) return true; if (match_str_either(data, "Quit") && (data->server_port == 25 || data->client_port == 25)) return true; /* Match the server banner code */ if (match_smtp_banner(data->payload[0], data->payload_len[0])) { if (match_smtp_command(data->payload[1], data->payload_len[1])) return true; } if (match_smtp_banner(data->payload[1], data->payload_len[1])) { if (match_smtp_command(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_smtp = { LPI_PROTO_SMTP, LPI_CATEGORY_MAIL, "SMTP", 2, match_smtp }; void register_smtp(LPIModuleMap *mod_map) { register_protocol(&lpi_smtp, mod_map); } ================================================ FILE: lib/tcp/lpi_smtps.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_smtps(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This rule matches legacy secure SMTP - this stuff shouldn't * really exist anymore... */ if (!match_ssl(data)) return false; /* Secure SMTP uses port 465 */ if (data->server_port != 465 && data->client_port != 465) return false; return true; } static lpi_module_t lpi_smtps = { LPI_PROTO_SMTPS, LPI_CATEGORY_MAIL, "SMTP_Secure", 5, /* Should be a higher priority than regular SSL */ match_smtps }; void register_smtps(LPIModuleMap *mod_map) { register_protocol(&lpi_smtps, mod_map); } ================================================ FILE: lib/tcp/lpi_socks4.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_socks4_req(uint32_t payload, uint32_t len) { /* Assuming port 80 for now - will update if we see other ports * used * * Octets 3 and 4 contain the port number */ if (!(MATCH(payload, 0x04, 0x01, 0x00, 0x50))) return false; /* Port 25 */ if (!(MATCH(payload, 0x04, 0x01, 0x00, 0x19))) return false; if (len != 9) return false; return true; } static inline bool match_socks4_resp(uint32_t payload, uint32_t len) { if (len == 0) return true; /* Haven't seen any legit responses yet :/ */ return false; } static inline bool match_socks4(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_socks4_req(data->payload[0], data->payload_len[0])) { if (match_socks4_resp(data->payload[1], data->payload_len[1])) return true; } if (match_socks4_req(data->payload[1], data->payload_len[1])) { if (match_socks4_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_socks4 = { LPI_PROTO_SOCKS4, LPI_CATEGORY_TUNNELLING, "SOCKS4", 5, match_socks4 }; void register_socks4(LPIModuleMap *mod_map) { register_protocol(&lpi_socks4, mod_map); } ================================================ FILE: lib/tcp/lpi_socks5.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_socks5_req(uint32_t payload, uint32_t len) { /* Just assume "no auth" method supported, for now */ if (!(MATCH(payload, 0x05, 0x01, 0x00, 0x00))) return false; if (len != 3) return false; return true; } static inline bool match_socks5_resp(uint32_t payload, uint32_t len) { if (len == 0) return true; /* Just assume "no auth" method supported, for now */ if (!(MATCH(payload, 0x05, 0x00, 0x00, 0x00))) return false; if (len != 2) return false; return true; } static inline bool match_socks5(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_socks5_req(data->payload[0], data->payload_len[0])) { if (match_socks5_resp(data->payload[1], data->payload_len[1])) return true; } if (match_socks5_req(data->payload[1], data->payload_len[1])) { if (match_socks5_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_socks5 = { LPI_PROTO_SOCKS5, LPI_CATEGORY_TUNNELLING, "SOCKS5", 3, match_socks5 }; void register_socks5(LPIModuleMap *mod_map) { register_protocol(&lpi_socks5, mod_map); } ================================================ FILE: lib/tcp/lpi_spdy.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_spdy_syn(uint32_t payload) { if (MATCH(payload, 0x80, 0x03, 0x00, 0x01)) return true; return false; } static inline bool match_spdy_settings(uint32_t payload) { if (MATCH(payload, 0x80, 0x03, 0x00, 0x04)) return true; return false; } static inline bool match_spdy_syn_reply(uint32_t payload) { if (MATCH(payload, 0x80, 0x03, 0x00, 0x02)) return true; return false; } static inline bool match_spdy_ping(uint32_t payload, uint32_t len){ if (MATCH(payload, 0x80, 0x03, 0x00, 0x06) && len == 12) return true; return false; } static inline bool match_spdy(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_spdy_syn(data->payload[0])) { if (match_spdy_settings(data->payload[1])) return true; if (match_spdy_syn_reply(data->payload[1])) return true; } if (match_spdy_syn(data->payload[1])) { if (match_spdy_settings(data->payload[0])) return true; if (match_spdy_syn_reply(data->payload[0])) return true; } if (match_spdy_settings(data->payload[0]) && data->payload_len[0] == 28){ if (match_spdy_ping(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_spdy = { LPI_PROTO_SPDY, LPI_CATEGORY_WEB, "SPDY", 10, match_spdy }; void register_spdy(LPIModuleMap *mod_map) { register_protocol(&lpi_spdy, mod_map); } ================================================ FILE: lib/tcp/lpi_speedify.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Be super careful with this one -- looks a lot like Google Hangouts * and Facebook TURN :/ */ static inline bool match_speedify_header(uint32_t payload, uint32_t len) { /* 2 byte length field */ if (len == 118 && MATCH(payload, 0x00, 0x74, 0x00, 0x01)) { return true; } return false; } static inline bool match_speedify(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_speedify_header(data->payload[0], data->payload_len[0])) { if (match_speedify_header(data->payload[1], data->payload_len[1])) { return true; } } return false; } static lpi_module_t lpi_speedify = { LPI_PROTO_SPEEDIFY, LPI_CATEGORY_TUNNELLING, "SpeedifyVPN", 199, match_speedify }; void register_speedify(LPIModuleMap *mod_map) { register_protocol(&lpi_speedify, mod_map); } ================================================ FILE: lib/tcp/lpi_speedin.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Speedin a.k.a. InVPN -- VPN for accessing Chinese content from outside * of China. */ static inline bool match_speedin_3byte(uint32_t payload, uint32_t len) { if (len == 3 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_speedin_other(uint32_t payload, uint32_t len) { if (len <= 75 || len >= 137) return false; if (MATCH(payload, 0x23, 0x00, ANY, ANY)) return true; if (MATCH(payload, 0x03, 0x00, ANY, ANY)) return true; return false; } static inline bool match_port(uint16_t server, uint16_t client) { if (server == 12000 || client == 12000) return true; if (server == 11100 || client == 11100) return true; if (server == 11000 || client == 11000) return true; /* Starting to see this on port 443 now :( */ if (server == 443 || client == 443) return true; return false; } static inline bool match_speedin(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_port(data->server_port, data->client_port)) return false; if (match_speedin_3byte(data->payload[0], data->payload_len[0])) { if (match_speedin_other(data->payload[1], data->payload_len[1])) return true; } if (match_speedin_3byte(data->payload[1], data->payload_len[1])) { if (match_speedin_other(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_speedin = { LPI_PROTO_SPEEDIN, LPI_CATEGORY_TUNNELLING, "Speedin", 22, match_speedin }; void register_speedin(LPIModuleMap *mod_map) { register_protocol(&lpi_speedin, mod_map); } ================================================ FILE: lib/tcp/lpi_speedtest.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_speedtest_hi(uint32_t payload, uint32_t len) { if (len != 3) return false; if (!MATCH(payload, 'H', 'I', 0x0a, 0x00)) return false; return true; } static inline bool match_speedtest_bighi(uint32_t payload, uint32_t len) { if (len == 40 && MATCH(payload, 'H', 'I', 0x20, ANY)) return true; return false; } static inline bool match_speedtest_hello(uint32_t payload, uint32_t len) { if (len == 0) return true; if (!MATCH(payload, 'H', 'E', 'L', 'L')) return false; return true; } static inline bool match_speedtest(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_speedtest_hi(data->payload[0], data->payload_len[0])) { if (match_speedtest_hello(data->payload[1], data->payload_len[1])) { return true; } } if (match_speedtest_hi(data->payload[1], data->payload_len[1])) { if (match_speedtest_hello(data->payload[0], data->payload_len[0])) { return true; } } if (match_speedtest_bighi(data->payload[0], data->payload_len[0])) { if (match_speedtest_hello(data->payload[1], data->payload_len[1])) { return true; } } if (match_speedtest_bighi(data->payload[1], data->payload_len[1])) { if (match_speedtest_hello(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_speedtest = { LPI_PROTO_SPEEDTEST, LPI_CATEGORY_MONITORING, "Speedtest.net", 5, match_speedtest }; void register_speedtest(LPIModuleMap *mod_map) { register_protocol(&lpi_speedtest, mod_map); } ================================================ FILE: lib/tcp/lpi_spotify.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_spotify_02_req(uint32_t payload, uint32_t len) { uint32_t len_field = 0; /* Type 0x02 has a 16 bit length field */ /* The 0x01 is part of the length too... */ if (!MATCH(payload, 0x00, 0x02, 0x01, ANY)) return false; /* The last byte is the length of the packet - 256 */ len_field = (ntohl(payload)) & 0xff; if (len_field == len - 256) return true; return false; } static inline bool match_spotify_04_req(uint32_t payload, uint32_t len) { if (!MATCH(payload, 0x00, 0x04, 0x00, 0x00)) return false; return true; } static inline bool match_spotify_02_resp(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len < 512) return false; if (!MATCH(payload, 0x00, ANY, ANY, ANY)) return false; return true; } static inline bool match_spotify_04_resp(uint32_t payload, uint32_t len) { if (len == 0) return true; if (ntohl(payload) != len) return false; return true; } static inline bool match_spotify_port(uint16_t port) { if (port == 4070) return true; if (port == 80) return true; if (port == 443) return true; return false; } static inline bool match_spotify(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Make sure we're using the right port */ if (!match_spotify_port(data->server_port) && !match_spotify_port(data->client_port)) { return false; } if (match_spotify_02_req(data->payload[0], data->payload_len[0])) { if (match_spotify_02_resp(data->payload[1], data->payload_len[1])) return true; } if (match_spotify_02_req(data->payload[1], data->payload_len[1])) { if (match_spotify_02_resp(data->payload[0], data->payload_len[0])) return true; } if (match_spotify_04_req(data->payload[0], data->payload_len[0])) { if (match_spotify_04_resp(data->payload[1], data->payload_len[1])) return true; } if (match_spotify_04_req(data->payload[1], data->payload_len[1])) { if (match_spotify_04_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_spotify = { LPI_PROTO_SPOTIFY, LPI_CATEGORY_STREAMING, "Spotify", 7, match_spotify }; void register_spotify(LPIModuleMap *mod_map) { register_protocol(&lpi_spotify, mod_map); } ================================================ FILE: lib/tcp/lpi_ssh.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ssh2_payload(uint32_t payload, uint32_t len) { /* SSH-2 begins with a four byte length field */ if (len == 0) return true; /* DON'T BYTESWAP!!! */ if (payload == len) return true; return false; } static inline bool match_ssh(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "SSH-")) return true; /* Require port 22 for the following rules as they are not * specific to SSH */ if (data->server_port != 22 && data->client_port != 22) return false; if (match_str_either(data, "QUIT")) return true; if (!match_ssh2_payload(data->payload[0], data->payload_len[0])) return false; if (!match_ssh2_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_ssh = { LPI_PROTO_SSH, LPI_CATEGORY_REMOTE, "SSH", 2, match_ssh }; void register_ssh(LPIModuleMap *mod_map) { register_protocol(&lpi_ssh, mod_map); } ================================================ FILE: lib/tcp/lpi_ssjj.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Some Chinese Flash-based FPS game */ static inline bool match_ssjj_3611(uint32_t payload, uint32_t len) { /* payload is a length field, but length exceeds typical MTU */ if (len > 1380 && MATCH(payload, 0x00, 0x00, 0x36, 0x11)) return true; return false; } static inline bool match_ssjj_61(uint32_t payload, uint32_t len) { /* payload is a length field */ if (len == 101 && MATCH(payload, 0x00, 0x00, 0x00, 0x61)) return true; return false; } static inline bool match_ssjj(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_ssjj_3611(data->payload[0], data->payload_len[0])) { if (match_ssjj_61(data->payload[1], data->payload_len[1])) return true; } if (match_ssjj_3611(data->payload[1], data->payload_len[1])) { if (match_ssjj_61(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_ssjj = { LPI_PROTO_SSJJ, LPI_CATEGORY_GAMING, "SSJJ", 5, match_ssjj }; void register_ssjj(LPIModuleMap *mod_map) { register_protocol(&lpi_ssjj, mod_map); } ================================================ FILE: lib/tcp/lpi_ssl.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_other_ssl(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_ssl(data)) return false; /* Ignore IMAPS and HTTPS, as these are separate protocols */ if (data->server_port == 993 || data->client_port == 993) return false; if (data->server_port == 443 || data->client_port == 443) return false; return true; } static lpi_module_t lpi_ssl = { LPI_PROTO_SSL, LPI_CATEGORY_ENCRYPT, "SSL/TLS", 100, /* Make this lower priority than IMAPS and HTTPS, just in case */ match_other_ssl }; void register_ssl(LPIModuleMap *mod_map) { register_protocol(&lpi_ssl, mod_map); } ================================================ FILE: lib/tcp/lpi_steam.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_old_steam(lpi_data_t *data) { /* Steam TCP Download */ if (!match_str_either(data, "\x01\x00\x00\x00")) return false; if (!match_chars_either(data, 0x00, 0x00, 0x00, ANY)) return false; if (data->payload_len[0] == 4 && data->payload_len[1] == 1) { return true; } if (data->payload_len[0] == 4 && data->payload_len[1] == 5) { return true; } if (data->payload_len[1] == 4 && data->payload_len[0] == 1) { return true; } if (data->payload_len[1] == 4 && data->payload_len[0] == 5) { return true; } return false; } static inline bool match_steam_len(uint32_t payload, uint32_t len) { /* length is stored as a little-endian integer */ #if BYTE_ORDER == BIG_ENDIAN uint32_t plen = bswap32(payload); #else uint32_t plen = payload; #endif if (plen == len - 8) { return true; } return false; } static inline bool match_steam_vt01(lpi_data_t *data) { /* I imagine other ports are possible? */ if (data->server_port != 27050 && data->client_port != 27050) { return false; } /* Observed length pairs so far: * 150, 76 */ if (match_steam_len(data->payload[0], data->payload_len[0])) { if (match_steam_len(data->payload[1], data->payload_len[1])) { return true; } } return false; } static inline bool match_steam(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_old_steam(data)) return true; if (match_steam_vt01(data)) { return true; } return false; } static lpi_module_t lpi_steam = { LPI_PROTO_STEAM, LPI_CATEGORY_GAMING, "Steam_TCP", 104, /* Might not be as reliable as some other rules (?) */ match_steam }; void register_steam(LPIModuleMap *mod_map) { register_protocol(&lpi_steam, mod_map); } ================================================ FILE: lib/tcp/lpi_stratum.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool possible_port(uint16_t porta, uint16_t portb) { /* Bit hax, but the payload alone doesn't exactly feel * unique. */ if (porta >= 3300 && porta < 3400) return true; if (portb >= 3300 && portb < 3400) return true; return false; } /* Protocol used for pooled bitcoin mining */ static inline bool match_stratum(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port can vary but usually something around 3357 */ if (!possible_port(data->server_port, data->client_port)) return false; if (MATCH(data->payload[0], '{', '"', 'i', 'd')) { if (MATCH(data->payload[1], '{', '"', 'i', 'd')) return true; } return false; } static lpi_module_t lpi_stratum = { LPI_PROTO_STRATUM, LPI_CATEGORY_ECOMMERCE, "Stratum", 200, match_stratum }; void register_stratum(LPIModuleMap *mod_map) { register_protocol(&lpi_stratum, mod_map); } ================================================ FILE: lib/tcp/lpi_stun.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_stun_payload(uint32_t payload, uint32_t len) { /* Bytes 3 and 4 are the Message Length - the STUN header */ if ((ntohl(payload) & 0x0000ffff) != len - 20) return false; if (MATCH(payload, 0x00, 0x01, ANY, ANY)) return true; if (MATCH(payload, 0x01, 0x01, ANY, ANY)) return true; if (MATCH(payload, 0x01, 0x11, ANY, ANY)) return true; if (MATCH(payload, 0x00, 0x03, ANY, ANY)) return true; if (MATCH(payload, 0x01, 0x03, ANY, ANY)) return true; if (MATCH(payload, 0x01, 0x13, ANY, ANY)) return true; return false; } static inline bool match_stun_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Wouldn't have expected to see STUN over TCP, but sure we can * match that. */ if (match_str_either(data, "RSP/")) return true; /* We can also see more conventional STUN payloads over TCP as well :/ */ if (data->server_port == 3478 || data->client_port == 3478) { if (match_stun_payload(data->payload[0], data->payload_len[0])) { if (match_stun_payload(data->payload[1], data->payload_len[1])) { return true; } } } return false; } static lpi_module_t lpi_stun_tcp = { LPI_PROTO_STUN, LPI_CATEGORY_NAT, "STUN_TCP", 5, match_stun_tcp }; void register_stun_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_stun_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_supl.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* SUPL - protocol to support location based services */ static inline bool match_supl_out(uint32_t payload, uint32_t len) { /* First two bytes are a length field, followed by two bytes of version */ if (len == 32 && MATCH(payload, 0x00, 0x20, 0x02, 0x00)) return true; return false; } static inline bool match_supl_in(uint32_t payload, uint32_t len) { /* First two bytes are a length field, followed by two bytes of version */ if (len == 18 && MATCH(payload, 0x00, 0x12, 0x02, 0x00)) return true; return false; } static inline bool match_supl(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 7275 && data->client_port != 7275) return false; if (match_supl_out(data->payload[0], data->payload_len[0])) { if (match_supl_in(data->payload[1], data->payload_len[1])) return true; } if (match_supl_out(data->payload[1], data->payload_len[1])) { if (match_supl_in(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_supl = { LPI_PROTO_SUPL, LPI_CATEGORY_LOCATION, "SUPL", 12, match_supl }; void register_supl(LPIModuleMap *mod_map) { register_protocol(&lpi_supl, mod_map); } ================================================ FILE: lib/tcp/lpi_svn.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_svn_greet(uint32_t payload, uint32_t len) { if (MATCHSTR(payload, "( su")) return true; return false; } static inline bool match_svn_resp(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCHSTR(payload, "( 2 ")) return true; return false; } static inline bool match_svn(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_svn_greet(data->payload[0], data->payload_len[0])) { if (match_svn_resp(data->payload[1], data->payload_len[1])) return true; } if (match_svn_greet(data->payload[1], data->payload_len[1])) { if (match_svn_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_svn = { LPI_PROTO_SVN, LPI_CATEGORY_RCS, "SVN", 3, match_svn }; void register_svn(LPIModuleMap *mod_map) { register_protocol(&lpi_svn, mod_map); } ================================================ FILE: lib/tcp/lpi_talesrunner.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* MMORPG from the people behind "Funtown" */ static inline bool match_0e01(uint32_t payload, uint32_t len) { if (len == 5 && MATCH(payload, 0x05, 0x00, 0x0e, 0x01)) return true; return false; } static inline bool match_0f(uint32_t payload, uint32_t len) { /* Bytes 1 and 2 are a length field, but length seems to * correlate strongly with the value of byte 4 */ if (len == 64 && MATCH(payload, 0x40, 0x00, 0x0f, 0x0b)) return true; if (len == 61 && MATCH(payload, 0x3d, 0x00, 0x0f, 0x08)) return true; if (len == 60 && MATCH(payload, 0x3c, 0x00, 0x0f, 0x07)) return true; return false; } static inline bool match_talesrunner(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* port 9153 */ if (match_0e01(data->payload[0], data->payload_len[0])) { if (match_0f(data->payload[1], data->payload_len[1])) return true; } if (match_0e01(data->payload[1], data->payload_len[1])) { if (match_0f(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_talesrunner = { LPI_PROTO_TALESRUNNER, LPI_CATEGORY_GAMING, "TalesRunner", 51, match_talesrunner }; void register_talesrunner(LPIModuleMap *mod_map) { register_protocol(&lpi_talesrunner, mod_map); } ================================================ FILE: lib/tcp/lpi_tankionline.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* A Flash-based version of TankiX */ static inline bool to_port(uint16_t porta, uint16_t portb) { if (porta == 5190 || porta == 15050) return true; if (portb == 15050 || portb == 5190) return true; return false; } static inline bool match_to(uint32_t payload, uint32_t len) { if (len == 44 && MATCH(payload, 0x00, 0x2a, 0x00, 0x03)) return true; return false; } static inline bool match_tankionline(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!to_port(data->server_port, data->client_port)) { return false; } /* The other direction is random MTU-sized payload. Apologies to * people with small MTUs. */ if (match_to(data->payload[0], data->payload_len[0])) { if (data->payload_len[1] >= 1300) return true; } if (match_to(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] >= 1300) return true; } return false; } static lpi_module_t lpi_tankionline = { LPI_PROTO_TANKIONLINE, LPI_CATEGORY_GAMING, "TankiOnline", 180, match_tankionline }; void register_tankionline(LPIModuleMap *mod_map) { register_protocol(&lpi_tankionline, mod_map); } ================================================ FILE: lib/tcp/lpi_tankix.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_tankix_19(uint32_t payload, uint32_t len) { if (MATCHSTR(payload, "\xff\x00\x00\x00") && len == 19) return true; return false; } static inline bool match_tankix(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 5050 */ if (match_tankix_19(data->payload[0], data->payload_len[0])) { if (MATCHSTR(data->payload[1], "\xff\x00\x00\x00")) return true; } if (match_tankix_19(data->payload[1], data->payload_len[1])) { if (MATCHSTR(data->payload[0], "\xff\x00\x00\x00")) return true; } return false; } static lpi_module_t lpi_tankix = { LPI_PROTO_TANKIX, LPI_CATEGORY_GAMING, "TankiX", 52, match_tankix }; void register_tankix(LPIModuleMap *mod_map) { register_protocol(&lpi_tankix, mod_map); } ================================================ FILE: lib/tcp/lpi_taobao.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Not entirely sure what this protocol is. Observed flows involve Taobao * CDN hosts and TCP port 80, but it is clearly not HTTP. Users doing this * protocol also speak conventional HTTP and HTTPS to the same Taobao host * at the same time, so it isn't a substitute for HTTP. Possibly a streaming * media protocol? * * For now I'm just going to use the generic name 'Taobao' and hope that * we can figure this out some time in the future. */ static inline bool match_taobao_req(uint32_t payload, uint32_t len) { /* Byte 4 is a length field, == len - 4 */ uint32_t taolen = ntohl(payload) & 0xffff; if (MATCH(payload, 0xf5, 0x00, ANY, ANY)) { if (taolen == len - 4) return true; } if (MATCH(payload, 0xf1, 0x00, ANY, ANY)) { if (taolen == len - 4) return true; } return false; } static inline bool match_taobao_resp(uint32_t payload, uint32_t len) { /* Byte 4 is a length field, == len - 4 */ uint32_t taolen = ntohl(payload) & 0xffff; if (MATCH(payload, 0xf3, 0x00, ANY, ANY)) { if (taolen == len - 4) return true; } return false; } /* Taobao seem to bastardize SSL. The request looks like a standard * TLS handshake, but the response is definitely something custom. */ static inline bool match_taobao_sslreq(uint32_t payload) { if (MATCH(payload, 0x16, 0x03, 0x01, 0x00)) return true; return false; } static inline bool match_taobao_sslresp(uint32_t payload) { if (MATCH(payload, 0x10, 0x3a, 0xf3, 0x00)) return true; if (MATCH(payload, 0x10, 0xae, 0xf3, 0x00)) return true; return false; } static inline bool match_taobao(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_taobao_req(data->payload[0], data->payload_len[0])) { if (match_taobao_resp(data->payload[1], data->payload_len[1])) return true; } if (match_taobao_req(data->payload[1], data->payload_len[1])) { if (match_taobao_resp(data->payload[0], data->payload_len[0])) return true; } if (match_taobao_sslreq(data->payload[0])) { if (match_taobao_sslresp(data->payload[1])) return true; } if (match_taobao_sslreq(data->payload[1])) { if (match_taobao_sslresp(data->payload[0])) return true; } return false; } static lpi_module_t lpi_taobao = { LPI_PROTO_TAOBAO, LPI_CATEGORY_CDN, "Taobao", 20, match_taobao }; void register_taobao(LPIModuleMap *mod_map) { register_protocol(&lpi_taobao, mod_map); } ================================================ FILE: lib/tcp/lpi_tds.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_tds_response(uint32_t payload, uint32_t len) { uint32_t stated_len = 0; if (len == 0) return true; if (!MATCH(payload, 0x04, 0x01, ANY, ANY)) return false; stated_len = (ntohl(payload) & 0xffff); if (stated_len != len) return false; return true; } static inline bool match_tds(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_tds_request(data->payload[0], data->payload_len[0])) { if (match_tds_response(data->payload[1], data->payload_len[1])) return true; } if (match_tds_request(data->payload[1], data->payload_len[1])) { if (match_tds_response(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_tds = { LPI_PROTO_TDS, LPI_CATEGORY_DATABASES, "TDS", 4, match_tds }; void register_tds(LPIModuleMap *mod_map) { register_protocol(&lpi_tds, mod_map); } ================================================ FILE: lib/tcp/lpi_teamviewer.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_teamviewer_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (!MATCH(payload, 0x17, 0x24, ANY, ANY)) return false; if (len < 256 && (ntohl(payload) & 0xff) != len - 5) return false; return true; } static inline bool match_teamviewer_alt(uint32_t payload, uint32_t len) { if (!MATCH(payload, 0x11, 0x30, 0x36, 0x00)) return false; return true; } static inline bool match_teamviewer_37(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x11, 0x30, 0x37, 0x00 && len == 32)) return true; return false; } static inline bool match_teamviewer_38(uint32_t payload) { if (MATCH(payload, 0x11, 0x30, 0x38, 0x00)) return true; return false; } static inline bool match_teamviewer(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_teamviewer_payload(data->payload[0], data->payload_len[0])) { if (match_teamviewer_payload(data->payload[1], data->payload_len[1])) return true; if (match_teamviewer_alt(data->payload[1], data->payload_len[1])) return true; } if (match_teamviewer_payload(data->payload[1], data->payload_len[1])) { if (match_teamviewer_payload(data->payload[0], data->payload_len[0])) return true; if (match_teamviewer_alt(data->payload[0], data->payload_len[0])) return true; } if (match_teamviewer_37(data->payload[0], data->payload_len[0])) { if (match_teamviewer_38(data->payload[1])) return true; } if (match_teamviewer_37(data->payload[1], data->payload_len[1])) { if (match_teamviewer_38(data->payload[0])) return true; } return false; } static lpi_module_t lpi_teamviewer = { LPI_PROTO_TEAMVIEWER, LPI_CATEGORY_REMOTE, "Teamviewer", 40, match_teamviewer }; void register_teamviewer(LPIModuleMap *mod_map) { register_protocol(&lpi_teamviewer, mod_map); } ================================================ FILE: lib/tcp/lpi_telecomkey.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_telecomkey(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Custom protocol used in transactions to telecomkey.com * * Not idea what it is, exactly. */ if (MATCH(data->payload[0], 0x30, 0x30, 0x30, 0x30) && data->payload_len[0] == 8) return true; if (MATCH(data->payload[1], 0x30, 0x30, 0x30, 0x30) && data->payload_len[1] == 8) return true; return false; } static lpi_module_t lpi_telecomkey = { LPI_PROTO_TELECOMKEY, LPI_CATEGORY_TELCO, "TelecomKey", 3, match_telecomkey }; void register_telecomkey(LPIModuleMap *mod_map) { register_protocol(&lpi_telecomkey, mod_map); } ================================================ FILE: lib/tcp/lpi_telegram.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" #include /* Protocol is documented at https://core.telegram.org/mtproto */ static inline bool match_abridged_telegram_query(uint32_t payload, uint32_t len) { if (MATCH(payload, 0xef, ANY, ANY, ANY)) { /* Bottom 7 bits of byte 2 are a length field */ uint32_t lenfield = ((ntohl(payload) >> 16) & 0x7f); if (len - 2 == lenfield * 4) { return true; } /* XXX Some clients appear to follow the query with some * other message which TCP will combine into the same * segment, so we can still fail the length check. Do * we want to consider removing the length check and just * rely on the 0x3f byte for matching this? */ } /* All 1s in the length field means the next three bytes are a * length field. In this case, the first packet will almost * certainly be MSS sized. */ if (MATCH(payload, 0xef, 0x7f, ANY, ANY)) { if (len >= 1300) return true; } return false; } static inline bool match_telegram_query(uint32_t payload, uint32_t len) { /* Random bytes but always 105 based on my observations */ if (len == 105) return true; return false; } static inline bool match_abridged_telegram_resp(uint32_t payload, uint32_t len) { /* Fast acknowledgement -- technically this should only match if * top bit of the length field is set, but we're probably ok to not * enforce that. */ if (len == 4 && (payload & 0x00000080)) return true; /* Look out for very large packets that won't fit in a single segment */ if (MATCH(payload, 0x7f, ANY, ANY, 0x00)) return true; /* Otherwise, first byte is the length field */ uint32_t lenfield = ((ntohl(payload) >> 24)); if (lenfield * 4 == len - 1) return true; return false; } static inline bool match_telegram_resp(uint32_t payload, uint32_t len) { /* First four bytes are a length field */ uint32_t lenfield = ntohl(payload); if (lenfield * 4 == len - 1) return true; return false; } static inline bool match_telegram(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_abridged_telegram_query(data->payload[0], data->payload_len[0])) { if (match_abridged_telegram_resp(data->payload[1], data->payload_len[1])) return true; } if (match_abridged_telegram_query(data->payload[1], data->payload_len[1])) { if (match_abridged_telegram_resp(data->payload[0], data->payload_len[0])) return true; } if (match_telegram_query(data->payload[0], data->payload_len[0])) { if (match_telegram_resp(data->payload[1], data->payload_len[1])) return true; } if (match_telegram_query(data->payload[1], data->payload_len[1])) { if (match_telegram_resp(data->payload[0], data->payload_len[0])) return true; } if (data->payload_len[0] == 96 && data->payload_len[1] == 52) { if (MATCH(data->payload[0], 0x60, 0x00, 0x00, 0x00) && MATCH(data->payload[1], 0x34, 0x00, 0x00, 0x00)) return true; } if (data->payload_len[1] == 96 && data->payload_len[0] == 52) { if (MATCH(data->payload[1], 0x60, 0x00, 0x00, 0x00) && MATCH(data->payload[0], 0x34, 0x00, 0x00, 0x00)) return true; } return false; } static lpi_module_t lpi_telegram = { LPI_PROTO_TELEGRAM, LPI_CATEGORY_CHAT, "TelegramMessenger", 10, match_telegram }; void register_telegram(LPIModuleMap *mod_map) { register_protocol(&lpi_telegram, mod_map); } ================================================ FILE: lib/tcp/lpi_telnet.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Rules adapted from l7-filter */ static inline bool match_telnet_pattern(uint32_t payload, uint32_t len) { /* Sadly we cannot use a simple MATCH, because we're looking for * two 0xff characters, which happens to be the same value as ANY. */ if (len >= 4) { if ((ntohl(payload) & 0xff0000ff) != (0xff0000ff)) return false; } else if (len == 3) { if ((ntohl(payload) & 0xff000000) != (0xff000000)) return false; } else return false; if (MATCH(payload, ANY, 0xfb, ANY, ANY)) return true; if (MATCH(payload, ANY, 0xfc, ANY, ANY)) return true; if (MATCH(payload, ANY, 0xfd, ANY, ANY)) return true; if (MATCH(payload, ANY, 0xfe, ANY, ANY)) return true; return false; } static inline bool match_atos_telnet(uint32_t payload) { /* ATOS seems to be related to ADSL routers, which really shouldn't * be allowing telnet over the public internet */ if (MATCH(payload, 0x1b, 0x5b, 0x32, 0x4a)) return true; return false; } static inline bool match_telnet(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_telnet_pattern(data->payload[0], data->payload_len[0])) return true; if (match_telnet_pattern(data->payload[1], data->payload_len[1])) return true; if (match_atos_telnet(data->payload[0]) && data->payload_len[1] == 0) return true; if (match_atos_telnet(data->payload[1]) && data->payload_len[0] == 0) return true; return false; } static lpi_module_t lpi_telnet = { LPI_PROTO_TELNET, LPI_CATEGORY_REMOTE, "Telnet", 2, match_telnet }; void register_telnet(LPIModuleMap *mod_map) { register_protocol(&lpi_telnet, mod_map); } ================================================ FILE: lib/tcp/lpi_telnet_exploit.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_telnet_exploit(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Anyone firing up a telnet session and immediately sending 'root', * as opposed to the initial telnet commands, is probably up to no * good */ if (data->server_port != 23 && data->client_port != 23) return false; if (MATCH(data->payload[0], 'r', 'o', 'o', 't')) return true; if (MATCH(data->payload[1], 'r', 'o', 'o', 't')) return true; /* This is a common way for telnet servers to drop unwanted clients * * Full string is: * * %connection closed by remote host! */ if (MATCH(data->payload[0], 0x0d, 0x0a, '%', 'c') && data->payload_len[1] == 0) return true; if (MATCH(data->payload[1], 0x0d, 0x0a, '%', 'c') && data->payload_len[0] == 0) return true; return false; } static lpi_module_t lpi_telnet_exploit = { LPI_PROTO_TELNET_EXPLOIT, LPI_CATEGORY_MALWARE, "TelnetExploit", 20, match_telnet_exploit }; void register_telnet_exploit(LPIModuleMap *mod_map) { register_protocol(&lpi_telnet_exploit, mod_map); } ================================================ FILE: lib/tcp/lpi_tencent_games.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* This traffic has been observed with BNS China, an MMO operated by * Tencent. I can't be sure whether this is exclusive to BNS or is used * by all Tencent games yet, so I'll use the generic name "TencentGames" * rather than assuming it is only BNS. */ static inline bool match_tcg_req(uint32_t payload, uint32_t len) { uint32_t hdrlen = (ntohl(payload) & 0xffff); if (hdrlen != len) return false; if (MATCH(payload, 0xd8, 0x5c, ANY, ANY)) return true; return false; } static inline bool match_tcg_reply(uint32_t payload, uint32_t len) { uint32_t hdrlen = (ntohl(payload) & 0xffff); if (hdrlen != len) return false; if (MATCH(payload, 0xd8, 0x5d, ANY, ANY)) return true; return false; } static inline bool match_tencent_games(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_tcg_req(data->payload[0], data->payload_len[0])) { if (match_tcg_reply(data->payload[1], data->payload_len[1])) return true; } if (match_tcg_req(data->payload[1], data->payload_len[1])) { if (match_tcg_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_tencent_games = { LPI_PROTO_TENCENT_GAMES, LPI_CATEGORY_GAMING, "TencentGames", 5, match_tencent_games }; void register_tencent_games(LPIModuleMap *mod_map) { register_protocol(&lpi_tencent_games, mod_map); } ================================================ FILE: lib/tcp/lpi_tenfivecoin.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_tfc_magic(uint32_t payload, uint32_t len) { if (len == 24 && MATCH(payload, 0xfa, 0xbf, 0xb5, 0xda)) return true; return false; } static inline bool match_tenfivecoin(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_tfc_magic(data->payload[0], data->payload_len[0])) { if (match_tfc_magic(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_tenfivecoin = { LPI_PROTO_TENFIVECOIN, LPI_CATEGORY_ECOMMERCE, "TenFiveCoin", 12, match_tenfivecoin }; void register_tenfivecoin(LPIModuleMap *mod_map) { register_protocol(&lpi_tenfivecoin, mod_map); } ================================================ FILE: lib/tcp/lpi_tensafe.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* TenSafe is an anti-cheat mechanism that is included with major * online games published by Tencent, e.g. Blade N Soul, DNF. */ static inline bool match_tensafe_req(uint32_t payload, uint32_t len) { if (len != 42) return false; if (MATCH(payload, 0x01, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_tensafe_resp(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len != 50) return false; if (MATCH(payload, 0x01, 0x00, 0x00, 0x00)) return true; return false; } static inline bool is_tensafe_port(uint16_t server, uint16_t client) { if (server == 8080 || server == 80 || server == 443) return true; if (server == 10012) return true; if (client == 8080 || client == 80 || client == 443) return true; if (client == 10012) return true; return false; } static inline bool match_tensafe(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!is_tensafe_port(data->server_port, data->client_port)) return false; if (match_tensafe_req(data->payload[0], data->payload_len[0])) { if (match_tensafe_resp(data->payload[1], data->payload_len[1])) return true; } if (match_tensafe_req(data->payload[1], data->payload_len[1])) { if (match_tensafe_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_tensafe = { LPI_PROTO_TENSAFE, LPI_CATEGORY_GAMING, "TenSafe", 70, match_tensafe }; void register_tensafe(LPIModuleMap *mod_map) { register_protocol(&lpi_tensafe, mod_map); } ================================================ FILE: lib/tcp/lpi_tera.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_tera_resp(uint32_t payload, uint32_t len) { if (len != 4) return false; if (MATCH(payload, 0x01, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_tera(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* XXX This traffic generally only appears on port 10001 */ /* First C->S packet is 128 bytes, but first bytes are random */ if (data->payload_len[1] == 128) { if (match_tera_resp(data->payload[0], data->payload_len[0])) return true; } if (data->payload_len[0] == 128) { if (match_tera_resp(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_tera = { LPI_PROTO_TERA, LPI_CATEGORY_GAMING, "Tera", 8, match_tera }; void register_tera(LPIModuleMap *mod_map) { register_protocol(&lpi_tera, mod_map); } ================================================ FILE: lib/tcp/lpi_tetrisonline.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Only ever seen this on port 80 to hosts owned by Tetris Online. This * may not be exclusive to Tetris Online (i.e. it might be a generic flash * game protocol) but I can't be sure until I see it somewhere else. */ static inline bool match_tetrisonline(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 80 && data->client_port != 80) return false; if (MATCH(data->payload[0], 'U', 'S', 'R', ' ')) { if (MATCH(data->payload[1], 'U', 'S', 'R', ' ')) return true; } return false; } static lpi_module_t lpi_tetrisonline = { LPI_PROTO_TETRISONLINE, LPI_CATEGORY_GAMING, "TetrisOnline", 5, match_tetrisonline }; void register_tetrisonline(LPIModuleMap *mod_map) { register_protocol(&lpi_tetrisonline, mod_map); } ================================================ FILE: lib/tcp/lpi_thedivision.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Tom Clancy's The Division -- Ubisoft game */ static inline bool match_div_36(uint32_t payload, uint32_t len) { if (len == 36 && MATCH(payload, 0x46, 0x01, 0x02, 0x20)) return true; return false; } static inline bool match_div_8(uint32_t payload, uint32_t len) { if (len == 8 && MATCH(payload, 0x0e, 0x01, 0x00, 0x04)) return true; return false; } static inline bool match_thedivision(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 55000? */ if (match_div_36(data->payload[0], data->payload_len[0])) { if (match_div_8(data->payload[1], data->payload_len[1])) return true; } if (match_div_36(data->payload[1], data->payload_len[1])) { if (match_div_8(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_thedivision = { LPI_PROTO_THE_DIVISION, LPI_CATEGORY_GAMING, "TheDivision", 5, match_thedivision }; void register_thedivision(LPIModuleMap *mod_map) { register_protocol(&lpi_thedivision, mod_map); } ================================================ FILE: lib/tcp/lpi_tip.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_tip(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "PUSH")) return true; return false; } static lpi_module_t lpi_tip = { LPI_PROTO_TIP, LPI_CATEGORY_ECOMMERCE, "TIP", 5, /* Not a very strong rule */ match_tip }; void register_tip(LPIModuleMap *mod_map) { register_protocol(&lpi_tip, mod_map); } ================================================ FILE: lib/tcp/lpi_tor.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_tor(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* I *think* this is TOR but have not confirmed */ /* Don't believe in this rule anymore :) */ /* if (match_chars_either(data, 0x3d, 0x00, 0x00, 0x00) && (data->payload_len[0] == 4 || data->payload_len[1] == 4)) return true; */ /* Lots of TOR is SSL over port 443, which we can't really distinguish * from HTTPS. However, we can match the stuff on port 9001 */ if (!match_ssl(data)) return false; if (data->server_port == 9001 || data->client_port == 9001) return true; return false; } static lpi_module_t lpi_tor = { LPI_PROTO_TOR, LPI_CATEGORY_TUNNELLING, "TOR", 7, /* Not the strongest rule */ match_tor }; void register_tor(LPIModuleMap *mod_map) { register_protocol(&lpi_tor, mod_map); } ================================================ FILE: lib/tcp/lpi_tpkt.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* TPKT is a slightly annoying little protocol that is used by a variety of * applications. It is most notably used for RDP, but is also important for * anything based on the H.323 standard for multimedia conferencing (e.g. * Cisco CallManager). * * Basically, this module is going to be aimed at matching any generic * TPKT traffic that isn't something we can assign to a more specific * application, e.g. RDP */ static inline bool match_tpkt_generic(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_tpkt(data->payload[0], data->payload_len[0])) { if (match_tpkt(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_tpkt_generic = { LPI_PROTO_TPKT, LPI_CATEGORY_VOIP, /* Most TPKT stuff is for VOIP, conferencing etc */ "TPKT", 8, /* Must come after RDP and S7COMM but before RTMP */ match_tpkt_generic }; void register_tpkt_generic(LPIModuleMap *mod_map) { register_protocol(&lpi_tpkt_generic, mod_map); } ================================================ FILE: lib/tcp/lpi_trackmania.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_trackmania_3450(lpi_data_t *data) { /* Version of trackmania protocol usually seen on port 3450 */ if (data->server_port != 3450 && data->client_port != 3450) return false; if (match_str_both(data, "\x23\x00\x00\x00", "\x13\x00\x00\x00")) { if (!match_payload_length(ntohl(data->payload[0]), data->payload_len[0])) return false; if (!match_payload_length(ntohl(data->payload[1]), data->payload_len[1])) return false; return true; } if (match_str_either(data, "\x23\x00\x00\x00")) { if (data->payload_len[0] == 39 && data->payload_len[1] == 0) return true; if (data->payload_len[1] == 39 && data->payload_len[0] == 0) return true; } return false; } static inline bool match_trackmania_2350(lpi_data_t *data) { /* One version of the trackmania protocol, typically seen running * on port 2350 */ if (!match_payload_length(ntohl(data->payload[0]), data->payload_len[0])) return false; if (!match_payload_length(ntohl(data->payload[1]), data->payload_len[1])) return false; if (!match_chars_either(data, 0x1c, 0x00, 0x00, 0x00)) return false; return true; } static inline bool match_trackmania(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_trackmania_3450(data)) return true; if (match_trackmania_2350(data)) return true; return false; } static lpi_module_t lpi_trackmania = { LPI_PROTO_TRACKMANIA, LPI_CATEGORY_GAMING, "Trackmania", 3, match_trackmania }; void register_trackmania(LPIModuleMap *mod_map) { register_protocol(&lpi_trackmania, mod_map); } ================================================ FILE: lib/tcp/lpi_transocks.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Chinese VPN for accessing mainland content */ static inline bool match_ts_23(uint32_t payload, uint32_t len) { if (len == 23 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) { return true; } return false; } static inline bool match_ts_reply(uint32_t payload, uint32_t len) { /* Payload is random, but we could add rules to return false * if the payload is 00000000 or ffffffff (or any other clearly * intentional pattern), if this is generating FPs. */ /* Lower path MTUs would affect this number, but let's concentrate * on getting the lowest hanging fruit for now. */ if (len == 1460 || len == 1406 || len == 1356) { return true; } /* 503 is also a common length? also seen 501 and 507 occasionally.. */ if (len == 503) { return true; } /* Starting to see a bit of variation in reply sizes now :/ */ if (len >= 678 && len <= 688) { return true; } return false; } static inline bool match_transocks(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_ts_23(data->payload[0], data->payload_len[0])) { if (match_ts_reply(data->payload[1], data->payload_len[1])) { return true; } } if (match_ts_23(data->payload[0], data->payload_len[0])) { if (match_ts_reply(data->payload[1], data->payload_len[1])) { return true; } } return false; } static lpi_module_t lpi_transocks = { LPI_PROTO_TRANSOCKS, LPI_CATEGORY_TUNNELLING, "Transocks", 240, match_transocks }; void register_transocks(LPIModuleMap *mod_map) { register_protocol(&lpi_transocks, mod_map); } ================================================ FILE: lib/tcp/lpi_trion.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Trion - publisher of F2P online games e.g. Archeage, Trove, etc. * * For now, I'm just going to group all Trion's games into a single "protocol" * as I doubt there is much need to make a distinction. */ /* This is probably a length field */ static inline bool match_trion_29(uint32_t payload, uint32_t len) { if (len != 29) return false; if (!MATCH(payload, 0x18, 0x00, 0x00, 0x00)) return false; return true; } /* This is probably a length field */ static inline bool match_trion_23(uint32_t payload, uint32_t len) { if (len != 23) return false; if (!MATCH(payload, 0x12, 0x00, 0x00, 0x00)) return false; return true; } static inline bool match_trion_37(uint32_t payload, uint32_t len) { if (len == 37 && MATCH(payload, 0x20, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_trion_1c(uint32_t payload, uint32_t len) { if (len == 263 && MATCH(payload, 0x1c, 0x80, 0x20, 0x00)) return true; return false; } static inline bool match_trion_2080(uint32_t payload, uint32_t len) { if (len == 263 && MATCH(payload, 0x20, 0x80, 0x20, 0x00)) return true; return false; } static inline bool match_trion(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* We can also try to limit to port 6560 and 37000-37100, if * necessary */ if (match_trion_29(data->payload[0], data->payload_len[0])) { if (match_trion_23(data->payload[1], data->payload_len[1])) return true; } if (match_trion_29(data->payload[1], data->payload_len[1])) { if (match_trion_23(data->payload[0], data->payload_len[0])) return true; } /* RIFT and Defiance require TCP port 6540 and 50000 and use a * different payload pattern */ if (match_trion_1c(data->payload[0], data->payload_len[0])) { if (match_trion_2080(data->payload[1], data->payload_len[1])) return true; } if (match_trion_1c(data->payload[1], data->payload_len[1])) { if (match_trion_2080(data->payload[0], data->payload_len[0])) return true; } if (match_trion_37(data->payload[0], data->payload_len[0])) { if (match_trion_37(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_trion = { LPI_PROTO_TRION, LPI_CATEGORY_GAMING, "TrionGames", 8, match_trion }; void register_trion(LPIModuleMap *mod_map) { register_protocol(&lpi_trion, mod_map); } ================================================ FILE: lib/tcp/lpi_trojan_win32_generic_sb.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_socks_response(uint32_t payload, uint32_t len) { if (len == 3 && MATCH(payload, 0x05, 0x01, 0x00, 0x00)) return true; if (len == 9 && MATCH(payload, 0x04, 0x01, 0x00, 0x19)) return true; return false; } static inline bool match_trojan_request(uint32_t payload, uint32_t len) { /* This is the typical request packet sent to the SOCKS server * that the infected machines connect to */ if (len != 5) return false; if (!MATCH(payload, ANY, ANY, 0x00, 0x00)) return false; return true; } static inline bool match_trojan_other(uint32_t payload, uint32_t len) { /* Occasionally, the infected machine and the SOCKS server * exchange packets that have this payload */ if (!MATCH(payload, 0x01, 0x38, 0x71, 0x74)) return false; return true; } static inline bool match_trojan_win32_generic_sb(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 3000 && data->client_port != 3000) return false; if (match_trojan_other(data->payload[0], data->payload_len[0])) { if (match_trojan_other(data->payload[1], data->payload_len[1])) return true; } if (match_socks_response(data->payload[0], data->payload_len[0])) { if (match_trojan_request(data->payload[1], data->payload_len[1])) return true; } if (match_socks_response(data->payload[1], data->payload_len[1])) { if (match_trojan_request(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_trojan_win32_generic_sb = { LPI_PROTO_TROJAN_WIN32_GENERIC_SB, LPI_CATEGORY_MALWARE, "Trojan.Win32.Generic!SB", 10, match_trojan_win32_generic_sb }; void register_trojan_win32_generic_sb(LPIModuleMap *mod_map) { register_protocol(&lpi_trojan_win32_generic_sb, mod_map); } ================================================ FILE: lib/tcp/lpi_trojan_zeroaccess.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_zeroaccess_in(uint32_t payload, uint32_t len) { if (len != 20) return false; if (!MATCH(payload, 0xe5, 0xaa, 0xc0, 0x31)) return false; return true; } static inline bool match_zeroaccess_out(uint32_t payload, uint32_t len) { if (len == 0) return true; if (!MATCH(payload, 0xe5, 0xaa, 0xc0, 0x31)) return false; return true; } static inline bool match_trojan_zeroaccess(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* More info on this trojan can be found at * http://www.antivirus365.org/PCAntivirus/43465.html */ if (match_zeroaccess_in(data->payload[0], data->payload_len[0])) { if (match_zeroaccess_out(data->payload[1], data->payload_len[1])) return true; } if (match_zeroaccess_in(data->payload[1], data->payload_len[1])) { if (match_zeroaccess_out(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_trojan_zeroaccess = { LPI_PROTO_TROJAN_ZEROACCESS, LPI_CATEGORY_MALWARE, "TrojanZeroAccess", 10, match_trojan_zeroaccess }; void register_trojan_zeroaccess(LPIModuleMap *mod_map) { register_protocol(&lpi_trojan_zeroaccess, mod_map); } ================================================ FILE: lib/tcp/lpi_twitcasting.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Live self-streaming protocol, popular in Japan */ static inline bool match_tc_get(uint32_t payload) { /* Yes, they have managed to co-opt "GET" for this protocol */ if (MATCH(payload, 'G', 'E', 'T', 0x20)) return true; return false; } static inline bool match_tc_reply(uint32_t payload, uint32_t len) { /* Possible that bytes 3 and 4 are a length field? */ if (len == 19 && MATCH(payload, 'T', 'C', 0x0c, 0x00)) return true; return false; } static inline bool match_twitcasting(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Can use port 8094 if we need to */ if (match_tc_get(data->payload[0])) { if (match_tc_reply(data->payload[1], data->payload_len[1])) return true; } if (match_tc_get(data->payload[0])) { if (match_tc_reply(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_twitcasting = { LPI_PROTO_TWITCASTING, LPI_CATEGORY_STREAMING, "TwitCasting", 25, /* Should definitely be higher than HTTP */ match_twitcasting }; void register_twitcasting(LPIModuleMap *mod_map) { register_protocol(&lpi_twitcasting, mod_map); } ================================================ FILE: lib/tcp/lpi_twitch_irc.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Twitch IRC expects the use of a CAP command to check for membership lists. * The response will begin with :tmi.twitch.tv, regardless of what the * result of the CAP command is. */ static inline bool match_twitch_cap(uint32_t payload) { if (MATCH(payload, 'C', 'A', 'P', 0x20)) return true; return false; } static inline bool match_twitch_tmi(uint32_t payload) { if (MATCH(payload, ':', 't', 'm', 'i')) return true; return false; } static inline bool match_twitch_irc(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_twitch_cap(data->payload[1])) { if (match_twitch_tmi(data->payload[0])) { return true; } } if (match_twitch_cap(data->payload[0])) { if (match_twitch_tmi(data->payload[1])) { return true; } } return false; } static lpi_module_t lpi_twitch_irc = { LPI_PROTO_TWITCH_IRC, LPI_CATEGORY_CHAT, "TwitchIRC", 5, match_twitch_irc }; void register_twitch_irc(LPIModuleMap *mod_map) { register_protocol(&lpi_twitch_irc, mod_map); } ================================================ FILE: lib/tcp/lpi_utherverse.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Virtual world a la Second Life, but even more targeted towards virtual sex */ static inline bool match_uther_21(uint32_t payload, uint32_t len) { if (len == 21 && MATCH(payload, 0x11, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_uther_other(uint32_t payload, uint32_t len) { /* It's a length field, but in little endian */ /* Max length appears to be hard-coded to 1350 */ if (len > 1350) { return false; } else if (len == 1350) { if (MATCH(payload, ANY, ANY, 0x00, 0x00)) { if (!MATCH(payload, ANY, 0x00, 0x00, 0x00)) return true; } } else { if (bswap_le_to_host32(payload) == len + 4) { return true; } } return false; } static inline bool match_utherverse(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 4991 && data->client_port != 4991) { return false; } if (match_uther_21(data->payload[0], data->payload_len[0])) { if (match_uther_other(data->payload[1], data->payload_len[1])) return true; } if (match_uther_21(data->payload[1], data->payload_len[1])) { if (match_uther_other(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_utherverse = { LPI_PROTO_UTHERVERSE, LPI_CATEGORY_GAMING, "Utherverse", 200, match_utherverse }; void register_utherverse(LPIModuleMap *mod_map) { register_protocol(&lpi_utherverse, mod_map); } ================================================ FILE: lib/tcp/lpi_vainglory.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Vainglory -- MOBA for touch screens */ static inline bool match_vg_req(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x00, 0x86, 0x00, 0x05) && len == 136) return true; if (MATCH(payload, 0x00, 0x86, 0x00, 0x06) && len == 136) return true; return false; } static inline bool match_vg_resp(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x00, 0x03, 0x00, 0x07) && len == 5) return true; if (MATCH(payload, 0x00, 0x03, 0x00, 0x06) && len == 5) return true; return false; } static inline bool match_vainglory(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_vg_req(data->payload[0], data->payload_len[0])) { if (match_vg_resp(data->payload[1], data->payload_len[1])) return true; } if (match_vg_req(data->payload[1], data->payload_len[1])) { if (match_vg_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_vainglory = { LPI_PROTO_VAINGLORY, LPI_CATEGORY_GAMING, "Vainglory", 5, match_vainglory }; void register_vainglory(LPIModuleMap *mod_map) { register_protocol(&lpi_vainglory, mod_map); } ================================================ FILE: lib/tcp/lpi_vhdp2p.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_vhd(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x13, 'v', 'h', 'd') && len < 150) { return true; } return false; } static inline bool match_vhdp2p(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_vhd(data->payload[0], data->payload_len[0])) { if (match_vhd(data->payload[1], data->payload_len[1])) { return true; } } return false; } static lpi_module_t lpi_vhdp2p = { LPI_PROTO_VHDP2P, LPI_CATEGORY_P2P, "VHD_P2P", 7, match_vhdp2p }; void register_vhdp2p(LPIModuleMap *mod_map) { register_protocol(&lpi_vhdp2p, mod_map); } ================================================ FILE: lib/tcp/lpi_viber.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* I'm fairly confident this is viber - uses port 5242, destination is an * Amazon AWS server. Hard to test because capturing mobile traffic is much * trickier than capturing a desktop app */ static inline bool match_viber_in(uint32_t payload, uint32_t len) { /* First two bytes are length, but we only support one packet * type right now anyway */ if (len != 24) return false; if (MATCH(payload, 0x18, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_viber_4244_req(uint32_t payload, uint32_t len) { if (len == 96 && MATCH(payload, 0x60, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_viber_4244_resp(uint32_t payload, uint32_t len) { if (len == 56 && MATCH(payload, 0x38, 0x00, ANY, 0x04)) return true; if (len == 56 && MATCH(payload, 0x38, 0x00, ANY, 0x05)) return true; return false; } static inline bool match_viber_out(uint32_t payload, uint32_t len) { /* Again, bytes 1 and 2 are the length */ if (len != 154) return false; if (MATCH(payload, 0x9a, 0x00, ANY, 0x00)) return true; return false; } static inline bool match_viber(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Could enforce port 5242 if we're getting false positives */ if (match_viber_in(data->payload[0], data->payload_len[0])) { if (match_viber_out(data->payload[1], data->payload_len[1])) { return true; } if (data->payload_len[1] == 0) { if (data->server_port == 5242 || data->client_port == 5242) return true; } } if (match_viber_in(data->payload[1], data->payload_len[1])) { if (match_viber_out(data->payload[0], data->payload_len[0])) { return true; } if (data->payload_len[0] == 0) { if (data->server_port == 5242 || data->client_port == 5242) return true; } } /* Seen on port 4244 */ if (match_viber_4244_req(data->payload[0], data->payload_len[0])) { if (match_viber_4244_resp(data->payload[1], data->payload_len[1])) return true; } if (match_viber_4244_req(data->payload[1], data->payload_len[1])) { if (match_viber_4244_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_viber = { LPI_PROTO_VIBER, LPI_CATEGORY_VOIP, "Viber", 9, match_viber }; void register_viber(LPIModuleMap *mod_map) { register_protocol(&lpi_viber, mod_map); } ================================================ FILE: lib/tcp/lpi_vmware.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_vmware_banner(uint32_t payload) { if (MATCH(payload, '2', '2', '0', 0x20)) return true; return false; } static inline bool match_vmware_ssl(uint32_t payload) { if (MATCH(payload, 0x16, 0x03, 0x01, 0x00)) return true; return false; } static inline bool match_vmware(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Require port 902 to avoid confusion with other SSL or "220 " * protocols */ if (data->server_port != 902 && data->client_port != 902) return false; if (match_vmware_banner(data->payload[0])) { if (match_vmware_ssl(data->payload[1])) return true; } if (match_vmware_banner(data->payload[1])) { if (match_vmware_ssl(data->payload[0])) return true; } return false; } static lpi_module_t lpi_vmware = { LPI_PROTO_VMWARE, LPI_CATEGORY_CLOUD, "VMWare", 125, match_vmware }; void register_vmware(LPIModuleMap *mod_map) { register_protocol(&lpi_vmware, mod_map); } ================================================ FILE: lib/tcp/lpi_vodlocker.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Vodlocker is basically HTTP, but it uses a non-standard port (8777) and * the capitalisation on the HTTP responses can be a bit inconsistent. * Rather than pollute HTTP with this crap, I think we can get away with * having a separate rule for it */ static inline bool match_vodlocker(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 8777 && data->client_port != 8777) return false; if (MATCH(data->payload[0], 'G', 'E', 'T', 0x20)) { if (MATCH(data->payload[1], 'H', 't', 'T', 'P')) return true; if (MATCH(data->payload[1], 'H', 'T', 'T', 'P')) return true; } if (MATCH(data->payload[1], 'G', 'E', 'T', 0x20)) { if (MATCH(data->payload[0], 'H', 't', 'T', 'P')) return true; if (MATCH(data->payload[0], 'H', 'T', 'T', 'P')) return true; } return false; } static lpi_module_t lpi_vodlocker = { LPI_PROTO_VODLOCKER, LPI_CATEGORY_WEB, "Vodlocker", 100, match_vodlocker }; void register_vodlocker(LPIModuleMap *mod_map) { register_protocol(&lpi_vodlocker, mod_map); } ================================================ FILE: lib/tcp/lpi_vpnrobot_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_um(uint32_t payload, uint32_t len) { /* First two bytes are a length field */ uint32_t hlen = ntohl(payload) >> 16; if (hlen == len - 2) { if (MATCH(payload, ANY, ANY, 'U', 'M')) return true; } return false; } static inline bool match_2byte_reply(uint32_t payload, uint32_t len) { if (len == 2 && MATCH(payload, 0x00, 0x0e, 0x00, 0x00)) return true; return false; } static inline bool match_vpnrobot_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Don't have any examples of a successful connection to a VPN * server yet, which may look a little different */ /* Commonly seen on ports 66 and 119 */ if (match_um(data->payload[0], data->payload_len[0])) { if (match_2byte_reply(data->payload[1], data->payload_len[1])) return true; } if (match_um(data->payload[1], data->payload_len[1])) { if (match_2byte_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_vpnrobot_tcp = { LPI_PROTO_VPNROBOT, LPI_CATEGORY_TUNNELLING, "VPNRobot", 55, match_vpnrobot_tcp }; void register_vpnrobot_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_vpnrobot_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_vpnunlimited_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Custom VPN protocol used by VPN Unlimited -- OpenVPN is the default, but * this is also offered for "ultimate security" (at some performance cost). */ /* Looks like first 2 bytes are a length field */ static inline bool match_vpn_req(uint32_t payload, uint32_t len) { if (len == 44 && MATCH(payload, 0x00, 0x2a, 0x5e, 0x4d)) return true; return false; } static inline bool match_vpn_resp(uint32_t payload, uint32_t len) { if (len == 56 && MATCH(payload, 0x00, 0x36, 0x26, 0x51)) return true; return false; } static inline bool match_vpnunlimited_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Always seen on port 443 */ if (match_vpn_req(data->payload[0], data->payload_len[0])) { if (match_vpn_resp(data->payload[1], data->payload_len[1])) return true; } if (match_vpn_req(data->payload[1], data->payload_len[1])) { if (match_vpn_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_vpnunlimited_tcp = { LPI_PROTO_VPN_UNLIMITED, LPI_CATEGORY_TUNNELLING, "VPNUnlimitedTCP", 10, match_vpnunlimited_tcp }; void register_vpnunlimited_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_vpnunlimited_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_warcraft3.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_warcraft3(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Warcraft 3 packets all begin with 0xf7 */ if (!MATCH(data->payload[0], 0xf7, ANY, ANY, ANY) || !MATCH(data->payload[1], 0xf7, ANY, ANY, ANY)) return false; if (match_chars_either(data, 0xf7, 0x37, 0x12, 0x00)) return true; /* Another Warcraft 3 example added by Donald Neal */ if (match_chars_either(data, 0xf7, 0x1e, ANY, 0x00)) return true; /* XXX - I have my doubts about these rules */ #if 0 if (match_chars_either(proto_d, 0xf7, 0xf7, ANY, ANY)) return LPI_PROTO_WARCRAFT3; #endif return false; } static lpi_module_t lpi_warcraft3 = { LPI_PROTO_WARCRAFT3, LPI_CATEGORY_GAMING, "Warcraft3", 5, /* I'm a bit dubious about the value of this rule */ match_warcraft3 }; void register_warcraft3(LPIModuleMap *mod_map) { register_protocol(&lpi_warcraft3, mod_map); } ================================================ FILE: lib/tcp/lpi_web_junk.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_web_junk(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Connections to web servers where the client clearly is not * speaking HTTP. * * XXX Check flows matching this occasionally for new HTTP request * types that we've missed :( */ if (data->payload_len[0] == 0 || data->payload_len[1] == 0) return false; if (!match_http_request(data->payload[0], data->payload_len[0])) { if (MATCHSTR(data->payload[1], "HTTP")) return true; } if (!match_http_request(data->payload[1], data->payload_len[1])) { if (MATCHSTR(data->payload[0], "HTTP")) return true; } return false; } static lpi_module_t lpi_web_junk = { LPI_PROTO_WEB_JUNK, LPI_CATEGORY_MIXED, "Web_Junk", 210, match_web_junk }; void register_web_junk(LPIModuleMap *mod_map) { register_protocol(&lpi_web_junk, mod_map); } ================================================ FILE: lib/tcp/lpi_webex_stun.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Bastardization of the STUN protocol used by Cisco Webex */ static inline bool match_webex_req(uint32_t payload, uint32_t len) { if (len == 28 && MATCH(payload, 0x00, 0x03, 0x00, 0x08)) { return true; } return false; } static inline bool match_webex_resp(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x01, 0x13, 0x00, ANY)) { if ((ntohl(payload) & 0x0000ffff) == len - 20) return true; } return false; } static inline bool match_webex_stun(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 80 && data->client_port != 80) { return false; } if (match_webex_req(data->payload[0], data->payload_len[0])) { if (match_webex_resp(data->payload[1], data->payload_len[1])) { return true; } } if (match_webex_req(data->payload[1], data->payload_len[1])) { if (match_webex_resp(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_webex_stun = { LPI_PROTO_WEBEX_STUN, LPI_CATEGORY_TUNNELLING, "WebexSTUN", 140, match_webex_stun }; void register_webex_stun(LPIModuleMap *mod_map) { register_protocol(&lpi_webex_stun, mod_map); } ================================================ FILE: lib/tcp/lpi_weblogic.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_weblogic(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* T3 is the protocol used by Weblogic, a Java application server */ /* sa is the admin username for MSSQL databases */ if (MATCH(data->payload[1], 0x00, 0x02, 's', 'a')) { if (match_payload_length(data->payload[0], data->payload_len[0])) return true; if (data->client_port == 7001 || data->server_port == 7001) return true; } if (MATCH(data->payload[0], 0x00, 0x02, 's', 'a')) { if (match_payload_length(data->payload[1], data->payload_len[1])) return true; if (data->client_port == 7001 || data->server_port == 7001) return true; } return false; } static lpi_module_t lpi_weblogic = { LPI_PROTO_WEBLOGIC, LPI_CATEGORY_DATABASES, "Weblogic", 8, match_weblogic }; void register_weblogic(LPIModuleMap *mod_map) { register_protocol(&lpi_weblogic, mod_map); } ================================================ FILE: lib/tcp/lpi_wechat.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_wc_pair(uint32_t payloada, uint32_t lena, uint32_t payloadb, uint32_t lenb) { if (lena == 16 && MATCH(payloada, 0x00, 0x00, 0x00, 0x10)) { if (lenb == 16 && MATCH(payloadb, 0x00, 0x00, 0x00, 0x10)) return true; if (lenb == 18 && MATCH(payloadb, 0x00, 0x00, 0x00, 0x12)) return true; } if (lena == 21 && MATCH(payloada, 0x00, 0x00, 0x00, 0x15)) { if (lenb == 25 && MATCH(payloadb, 0x00, 0x00, 0x00, 0x19)) return true; if (lenb == 21 && MATCH(payloadb, 0x00, 0x00, 0x00, 0x15)) return true; } return false; } static inline bool match_wc_ab_request(uint32_t payload, uint32_t len) { /* This is 0xab, followed by 4 bytes of length for the first * packet. */ if (len <= 255 && MATCH(payload, 0xab, 0x00, 0x00, 0x00)) return true; if (MATCH(payload, 0xab, 0x00, 0x00, 0x01)) return true; return false; } static inline bool match_wc_ab_big02(uint32_t payload, uint32_t len) { /* again 0xab followed by length, except this time the length is * for the entire flow. */ if (len < 255) return false; /* Flows are unlikely to need a full 4 bytes for length so I'm * going to stick 0x00 or 0x01 in the top byte for now */ if (MATCH(payload, 0xab, 0x00, ANY, ANY)) { return true; } if (MATCH(payload, 0xab, 0x01, ANY, ANY)) { return true; } return false; } static inline bool match_wc_ab_big01(uint32_t payload, uint32_t len) { if (len < 100) return false; if (len <= 255 && MATCH(payload, 0xab, 0x00, 0x00, 0x00)) return true; if (len > 255 && len < 512 && MATCH(payload, 0xab, 0x00, 0x00, 0x01)) return true; if (len >= 512 && len < 768 && MATCH(payload, 0xab, 0x00, 0x00, 0x02)) return true; if (len >= 768 && len < 1024 && MATCH(payload, 0xab, 0x00, 0x00, 0x03)) return true; return false; } static inline bool match_wc_ab_reply(uint32_t payload, uint32_t len) { /* All replies appear to be 41 or 53 bytes */ if (len != 41 && len != 53) return false; if (MATCH(payload, 0xab, 0x00, 0x00, 0x00)) return true; return false; } /* This appears to be some sort of SSL ripoff */ static inline bool match_wc_ssl_111(uint32_t payload, uint32_t len) { if (len == 111 && MATCH(payload, 0x16, 0xf1, 0x03, 0x00)) return true; return false; } static inline bool match_wc_ssl_166(uint32_t payload, uint32_t len) { if (len == 166 && MATCH(payload, 0x16, 0xf1, 0x03, 0x00)) return true; return false; } static inline bool match_wechat(lpi_data_t *data, lpi_module_t *mod UNUSED) { bool valid_port = false; /* WeChat begins with a very simple 4 byte length field. * This is not unique to WeChat though, so we need to be careful. */ /* Only observed on port 80, 443, 14000, 10001 or 8080. Because the payload * signature is not entirely unique to WeChat, let's restrict matches * to flows using those ports unless it shows up on other ports. */ if (data->server_port == 80 || data->client_port == 80) valid_port = true; if (data->server_port == 8080 || data->client_port == 8080) valid_port = true; if (data->server_port == 443 || data->client_port == 443) valid_port = true; if (data->server_port == 14000 || data->client_port == 14000) valid_port = true; if (data->server_port == 10001 || data->client_port == 10001) valid_port = true; if (!valid_port) return false; if (match_wc_pair(data->payload[0], data->payload_len[0], data->payload[1], data->payload_len[1])) { return true; } if (match_wc_pair(data->payload[1], data->payload_len[1], data->payload[0], data->payload_len[0])) { return true; } if (match_wc_ab_request(data->payload[0], data->payload_len[0])) { if (match_wc_ab_reply(data->payload[1], data->payload_len[1])) return true; } if (match_wc_ab_request(data->payload[1], data->payload_len[1])) { if (match_wc_ab_reply(data->payload[0], data->payload_len[0])) return true; } if (match_wc_ab_big01(data->payload[0], data->payload_len[0])) { if (match_wc_ab_big02(data->payload[1], data->payload_len[1])) return true; } if (match_wc_ab_big01(data->payload[1], data->payload_len[1])) { if (match_wc_ab_big02(data->payload[0], data->payload_len[0])) return true; } if (match_wc_ssl_111(data->payload[0], data->payload_len[0])) { if (match_wc_ssl_166(data->payload[1], data->payload_len[1])) return true; } if (match_wc_ssl_111(data->payload[1], data->payload_len[1])) { if (match_wc_ssl_166(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_wechat = { LPI_PROTO_WECHAT, LPI_CATEGORY_CHAT, "WeChat", 10, match_wechat }; void register_wechat(LPIModuleMap *mod_map) { register_protocol(&lpi_wechat, mod_map); } ================================================ FILE: lib/tcp/lpi_weibo.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_weibo_req(uint32_t payload, uint32_t len) { if (len < 230) return false; if (payload + 4 == len) return true; return false; } static inline bool match_weibo_resp(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len == 30 && MATCH(payload, 0x1a, 0x00, 0x00, 0x00)) return true; if (len == 37 && MATCH(payload, 0x21, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_weibo(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 8080 && data->client_port != 8080) return false; if (match_weibo_req(data->payload[0], data->payload_len[0])) { if (match_weibo_resp(data->payload[1], data->payload_len[1])) return true; } if (match_weibo_req(data->payload[1], data->payload_len[1])) { if (match_weibo_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_weibo = { LPI_PROTO_WEIBO, LPI_CATEGORY_CHAT, "Weibo", 15, match_weibo }; void register_weibo(LPIModuleMap *mod_map) { register_protocol(&lpi_weibo, mod_map); } ================================================ FILE: lib/tcp/lpi_weiqi.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* AKA Fox Go -- Multiplayer Go client included with QQ Games */ static inline bool match_weiqi_tgw(uint32_t payload, uint32_t len) { if (len == 43 && MATCH(payload, 't', 'g', 'w', '_')) return true; return false; } static inline bool match_weiqi_other(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x00, 0x0e, 0x0f, 0xa5)) return true; return false; } static inline bool match_weiqi(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 8000 */ if (match_weiqi_tgw(data->payload[0], data->payload_len[0])) { if (match_weiqi_other(data->payload[1], data->payload_len[1])) return true; } if (match_weiqi_tgw(data->payload[1], data->payload_len[1])) { if (match_weiqi_other(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_weiqi = { LPI_PROTO_WEIQI, LPI_CATEGORY_GAMING, "WeiqiQQ", 20, match_weiqi }; void register_weiqi(LPIModuleMap *mod_map) { register_protocol(&lpi_weiqi, mod_map); } ================================================ FILE: lib/tcp/lpi_whatsapp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_wa_first(uint32_t payload, uint32_t len) { if (MATCH(payload, 'W', 'A', 0x01, 0x02)) return true; if (MATCH(payload, 'W', 'A', 0x01, 0x05)) return true; if (len == 1 && MATCH(payload, 'W', 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_wa_first_20(uint32_t payload, uint32_t len) { /* New protocol version? 2.0? */ if (MATCH(payload, 'W', 'A', 0x02, 0x00)) return true; if (len == 1 && MATCH(payload, 'W', 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_ed_first(uint32_t payload, uint32_t len) { if (MATCH(payload, 'E', 'D', 0x00, 0x01)) return true; if (len == 1 && MATCH(payload, 'E', 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_wa_second(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 0x00, 0x00, 0x05, 0xf8)) return true; return false; } static inline bool match_wa_second_20(uint32_t payload, uint32_t len) { uint32_t walen = ntohl(payload) >> 8; if (len == 0) return true; if (walen == len - 3) { if (MATCH(payload, ANY, ANY, ANY, 0x1a)) return true; } return false; } static inline bool match_wa_fixed_second(uint32_t payload) { if (MATCH(payload, 0x00, 0x00, 0x36, 0x1a)) { return true; } return false; } static inline bool match_whatsapp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* WhatsApp uses a modified form of XMPP and typically runs on * either port 443 or 5222 */ if (match_wa_first(data->payload[0], data->payload_len[0])) { if (match_wa_second(data->payload[1], data->payload_len[1])) return true; } if (match_wa_first(data->payload[1], data->payload_len[1])) { if (match_wa_second(data->payload[0], data->payload_len[0])) return true; } if (match_wa_first_20(data->payload[0], data->payload_len[0])) { if (match_wa_second_20(data->payload[1], data->payload_len[1])) return true; } if (match_wa_first_20(data->payload[1], data->payload_len[1])) { if (match_wa_second_20(data->payload[0], data->payload_len[0])) return true; } if (match_ed_first(data->payload[0], data->payload_len[0])) { if (match_wa_second_20(data->payload[1], data->payload_len[1])) return true; if (match_wa_fixed_second(data->payload[1])) return true; } if (match_ed_first(data->payload[1], data->payload_len[1])) { if (match_wa_second_20(data->payload[0], data->payload_len[0])) return true; if (match_wa_fixed_second(data->payload[0])) return true; } return false; } static lpi_module_t lpi_whatsapp = { LPI_PROTO_WHATSAPP, LPI_CATEGORY_CHAT, "WhatsApp", 4, match_whatsapp }; void register_whatsapp(LPIModuleMap *mod_map) { register_protocol(&lpi_whatsapp, mod_map); } ================================================ FILE: lib/tcp/lpi_whois.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_dot_second(uint32_t payload) { if (MATCH(payload, ANY, '.', ANY, ANY)) return true; return false; } static inline bool match_dot_third(uint32_t payload) { if (MATCH(payload, ANY, ANY, '.', ANY)) return true; return false; } static inline bool match_dot_last(uint32_t payload) { if (MATCH(payload, ANY, ANY, ANY, '.')) return true; return false; } static inline bool match_digit_first(uint32_t payload) { if (MATCH(payload, '1', ANY, ANY, ANY)) return true; if (MATCH(payload, '2', ANY, ANY, ANY)) return true; if (MATCH(payload, '3', ANY, ANY, ANY)) return true; if (MATCH(payload, '4', ANY, ANY, ANY)) return true; if (MATCH(payload, '5', ANY, ANY, ANY)) return true; if (MATCH(payload, '6', ANY, ANY, ANY)) return true; if (MATCH(payload, '7', ANY, ANY, ANY)) return true; if (MATCH(payload, '8', ANY, ANY, ANY)) return true; if (MATCH(payload, '9', ANY, ANY, ANY)) return true; if (MATCH(payload, '0', ANY, ANY, ANY)) return true; return false; } static inline bool match_digit_second(uint32_t payload) { if (MATCH(payload, ANY, '1', ANY, ANY)) return true; if (MATCH(payload, ANY, '2', ANY, ANY)) return true; if (MATCH(payload, ANY, '3', ANY, ANY)) return true; if (MATCH(payload, ANY, '4', ANY, ANY)) return true; if (MATCH(payload, ANY, '5', ANY, ANY)) return true; if (MATCH(payload, ANY, '6', ANY, ANY)) return true; if (MATCH(payload, ANY, '7', ANY, ANY)) return true; if (MATCH(payload, ANY, '8', ANY, ANY)) return true; if (MATCH(payload, ANY, '9', ANY, ANY)) return true; if (MATCH(payload, ANY, '0', ANY, ANY)) return true; return false; } static inline bool match_digit_third(uint32_t payload) { if (MATCH(payload, ANY, ANY, '1', ANY)) return true; if (MATCH(payload, ANY, ANY, '2', ANY)) return true; if (MATCH(payload, ANY, ANY, '3', ANY)) return true; if (MATCH(payload, ANY, ANY, '4', ANY)) return true; if (MATCH(payload, ANY, ANY, '5', ANY)) return true; if (MATCH(payload, ANY, ANY, '6', ANY)) return true; if (MATCH(payload, ANY, ANY, '7', ANY)) return true; if (MATCH(payload, ANY, ANY, '8', ANY)) return true; if (MATCH(payload, ANY, ANY, '9', ANY)) return true; if (MATCH(payload, ANY, ANY, '0', ANY)) return true; return false; } static inline bool match_digit_last(uint32_t payload) { if (MATCH(payload, ANY, ANY, ANY, '1')) return true; if (MATCH(payload, ANY, ANY, ANY, '2')) return true; if (MATCH(payload, ANY, ANY, ANY, '3')) return true; if (MATCH(payload, ANY, ANY, ANY, '4')) return true; if (MATCH(payload, ANY, ANY, ANY, '5')) return true; if (MATCH(payload, ANY, ANY, ANY, '6')) return true; if (MATCH(payload, ANY, ANY, ANY, '7')) return true; if (MATCH(payload, ANY, ANY, ANY, '8')) return true; if (MATCH(payload, ANY, ANY, ANY, '9')) return true; if (MATCH(payload, ANY, ANY, ANY, '0')) return true; return false; } static inline bool match_ipv4_text(uint32_t payload) { /* Gotta start with a digit */ if (!match_digit_first(payload)) return false; /* Matching the case 1.XX */ if (match_dot_second(payload)) { /* Can't have two dots in a row */ if (!match_digit_third(payload)) return false; /* We can have either two digits, e.g. 1.45 */ if (match_digit_last(payload)) return true; /* Or a another dot, e.g. 1.1. */ if (match_dot_last(payload)) return true; return false; } /* Not a dot so must be a digit, e.g. 11XX */ if (!match_digit_second(payload)) { return false; } /* If the third character is a dot, then we need a digit as the last * e.g. 10.4 */ if (match_dot_third(payload)) { if (!match_digit_last(payload)) return false; return true; } /* Third character must be a digit, then */ if (!match_digit_third(payload)) return false; /* If we've got three digits, we must end on a dot - e.g. 192. */ if (match_dot_last(payload)) return true; return false; } static inline bool match_md5_option(uint32_t payload) { if (MATCHSTR(payload, "-V M")) return true; return false; } static inline bool match_whois(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 43 && data->client_port != 43) return false; if (match_ipv4_text(data->payload[0])) { if (data->payload_len[0] >= 4) return true; } if (match_md5_option(data->payload[0])) return true; if (match_ipv4_text(data->payload[1])) { if (data->payload_len[1] >= 4) return true; } if (match_md5_option(data->payload[1])) return true; return false; } static lpi_module_t lpi_whois = { LPI_PROTO_WHOIS, LPI_CATEGORY_SERVICES, "Whois", 20, match_whois }; void register_whois(LPIModuleMap *mod_map) { register_protocol(&lpi_whois, mod_map); } ================================================ FILE: lib/tcp/lpi_winmx.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_winmx(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "SEND")) { if (data->payload_len[0] == 1) return true; if (data->payload_len[1] == 1) return true; } if (match_chars_either(data, 'G', 'E', 'T', ANY)) { if (data->payload_len[0] == 1) return true; if (data->payload_len[1] == 1) return true; } return false; } static lpi_module_t lpi_winmx = { LPI_PROTO_WINMX, LPI_CATEGORY_P2P, "WinMX", 4, /* Have this lower priority than HTTP - GET-based rule */ match_winmx }; void register_winmx(LPIModuleMap *mod_map) { register_protocol(&lpi_winmx, mod_map); } ================================================ FILE: lib/tcp/lpi_wizard101.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_wiz_23(uint32_t payload, uint32_t len) { /* Bytes 3 and 4 are a length field */ if (len == 23 && MATCH(payload, 0x0d, 0xf0, 0x13, 0x00)) return true; return false; } static inline bool match_wiz_13(uint32_t payload, uint32_t len) { /* Bytes 3 and 4 are a length field */ if (len == 13 && MATCH(payload, 0x0d, 0xf0, 0x09, 0x00)) return true; return false; } static inline bool match_wizard101(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_wiz_23(data->payload[0], data->payload_len[0])) { if (match_wiz_13(data->payload[1], data->payload_len[1])) return true; } if (match_wiz_23(data->payload[1], data->payload_len[1])) { if (match_wiz_13(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_wizard101 = { LPI_PROTO_WIZARD101, LPI_CATEGORY_GAMING, "Wizard101", 19, match_wizard101 }; void register_wizard101(LPIModuleMap *mod_map) { register_protocol(&lpi_wizard101, mod_map); } ================================================ FILE: lib/tcp/lpi_wns.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_wns(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (MATCH(data->payload[0], 'w', 'n', 's', 0x00)) { if (MATCH(data->payload[1], 'w', 'n', 's', 0x00)) return true; } return false; } static lpi_module_t lpi_wns = { LPI_PROTO_WNS, LPI_CATEGORY_CLOUD, "TencentWNS", 8, match_wns }; void register_wns(LPIModuleMap *mod_map) { register_protocol(&lpi_wns, mod_map); } ================================================ FILE: lib/tcp/lpi_wow.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_wow_request(uint32_t payload, uint32_t len) { if (!MATCH(payload, 0x00, 0x08, ANY, 0x00)) return false; payload = ntohl(payload); /* 3rd and 4th bytes are the size of the packet, minus the four * byte header */ if (htons(payload & 0xffff) == len - 4) return true; return false; } static inline bool match_wow_response(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len != 119) return false; if (!MATCH(payload, 0x00, 0x00, 0x00, ANY)) return false; return true; } static inline bool match_wow_s2c(uint32_t payload, uint32_t len) { /* WoW seems to have changed the server to client protocol recently, * possibly with the new expansion Cataclysm */ if (len == 0) return true; if (len != 50) return false; if (MATCH(payload, 0x30, 0x00, 0x57, 0x4f)) return true; return false; } static inline bool match_wow_2016(uint32_t payload, uint32_t len) { if (len == 47 || len == 48 || len == 52) { if (MATCHSTR(payload, "WORL")) return true; } return false; } static inline bool match_china_wow(uint32_t payload, uint32_t len) { if (len == 57 || len == 59) { if (MATCH(payload, 0x05, 0x01, 0x93, 0x01)) return true; if (MATCH(payload, 0x05, 0x01, 0x99, 0x01)) return true; } /* New alternative -- clearly a length field, rest of packet * is mostly JSON */ if (len == 112 && MATCH(payload, 0x00, 0x00, 0x00, 0x6c)) return true; if (len == 113 && MATCH(payload, 0x00, 0x00, 0x00, 0x6d)) return true; if (len == 114 && MATCH(payload, 0x00, 0x00, 0x00, 0x6e)) return true; return false; } static inline bool match_china_wow512(uint32_t payload, uint32_t len) { if (len == 512 && MATCH(payload, 0x00, 0x01, 0x00, 0x25)) return true; return false; } static inline bool match_china_wow03(uint32_t payload, uint32_t len) { uint32_t hdrlen; uint32_t swapped; if (!MATCH(payload, 0x03, 0x00, ANY, ANY)) { return false; } /* bytes 3 and 4 are a length field, but in little endian */ hdrlen = ntohl(payload); swapped = ((hdrlen & 0xff) << 8) + ((hdrlen & 0xff00) >> 8); if (swapped == len) { return true; } return false; } static inline bool chinese_wow_port(lpi_data_t *data) { if (data->server_port >= 8000 && data->server_port <= 8002) return true; if (data->client_port >= 8000 && data->client_port <= 8002) return true; if (data->server_port == 443 || data->client_port == 443) return true; if (data->server_port == 2082 || data->client_port == 2082) return true; return false; } static inline bool match_wow(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_wow_request(data->payload[0], data->payload_len[0])) { if (match_wow_response(data->payload[1], data->payload_len[1])) return true; } if (match_wow_request(data->payload[1], data->payload_len[1])) { if (match_wow_response(data->payload[0], data->payload_len[0])) return true; } if (match_wow_s2c(data->payload[0], data->payload_len[0])) { if (match_wow_s2c(data->payload[1], data->payload_len[1])) return true; } if (data->server_port == 3724 || data->client_port == 3724) { /* New initial exchange observed in packet traces from 2016 */ if (match_wow_2016(data->payload[0], data->payload_len[0]) && match_wow_2016(data->payload[1], data->payload_len[1])) { return true; } } /* Chinese WOW is a little different */ if (chinese_wow_port(data)) { if (match_wow_2016(data->payload[0], data->payload_len[0])) { if (match_wow_2016(data->payload[1], data->payload_len[1])) return true; if (match_china_wow(data->payload[1], data->payload_len[1])) return true; } if (match_wow_2016(data->payload[1], data->payload_len[1])) { if (match_china_wow(data->payload[0], data->payload_len[0])) return true; } if (match_china_wow(data->payload[0], data->payload_len[0])) { if (match_china_wow03(data->payload[1], data->payload_len[1])) return true; if (match_china_wow512(data->payload[1], data->payload_len[1])) return true; } if (match_china_wow(data->payload[1], data->payload_len[1])) { if (match_china_wow03(data->payload[0], data->payload_len[0])) return true; if (match_china_wow512(data->payload[0], data->payload_len[0])) return true; } } return false; } static lpi_module_t lpi_wow = { LPI_PROTO_WOW, LPI_CATEGORY_GAMING, "WorldOfWarcraft", 4, /* Not super-strong, especially for one-way */ match_wow }; void register_wow(LPIModuleMap *mod_map) { register_protocol(&lpi_wow, mod_map); } ================================================ FILE: lib/tcp/lpi_wuala.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_wuala_out(uint32_t payload, uint32_t len) { if (len != 18) return false; if (!MATCH(payload, 0xfe, 0x08, 0x00, 0x00)) return false; return true; } static inline bool match_wuala_in(uint32_t payload, uint32_t len) { if (len != 18) return false; if (!MATCH(payload, 0xfe, 0x18, 0x00, 0x00)) return false; return true; } static inline bool match_wuala(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_wuala_out(data->payload[0], data->payload_len[0])) { if (match_wuala_in(data->payload[1], data->payload_len[1])) return true; } if (match_wuala_out(data->payload[1], data->payload_len[1])) { if (match_wuala_in(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_wuala = { LPI_PROTO_WUALA, LPI_CATEGORY_CLOUD, "Wuala", 6, match_wuala }; void register_wuala(LPIModuleMap *mod_map) { register_protocol(&lpi_wuala, mod_map); } ================================================ FILE: lib/tcp/lpi_xiami.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_xiami(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->payload_len[0] == 187 && data->payload_len[1] == 0) { if (MATCH(data->payload[0], 0xbb, 0x00, 0x00, 0x00)) return true; } if (data->payload_len[1] == 187 && data->payload_len[0] == 0) { if (MATCH(data->payload[1], 0xbb, 0x00, 0x00, 0x00)) return true; } return false; } static lpi_module_t lpi_xiami = { LPI_PROTO_XIAMI, LPI_CATEGORY_STREAMING, "Xiami", 34, match_xiami }; void register_xiami(LPIModuleMap *mod_map) { register_protocol(&lpi_xiami, mod_map); } ================================================ FILE: lib/tcp/lpi_xmpp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_xmpp_payload(uint32_t data, uint32_t len) { if (MATCHSTR(data, "payload[0], data->payload_len[0])) return false; if (!match_xmpp_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_xmpp = { LPI_PROTO_XMPP, LPI_CATEGORY_CHAT, "XMPP", 4, match_xmpp }; void register_xmpp(LPIModuleMap *mod_map) { register_protocol(&lpi_xmpp, mod_map); } ================================================ FILE: lib/tcp/lpi_xmpps.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_gtalk(lpi_data_t *data) { /* This rule matches the encrypted traffic sent to google talk * clients */ if (!match_ssl(data)) return false; /* Port 5228 is used for this */ if (data->server_port != 5228 && data->client_port != 5228) return false; /* Try and avoid false positives using payload size checks */ if (data->payload_len[0] == 80 || data->payload_len[0] == 120 || data->payload_len[0] == 118 || data->payload_len[0] == 184) return true; if (data->payload_len[1] == 80 || data->payload_len[1] == 120 || data->payload_len[1] == 118 || data->payload_len[1] == 184) return true; return false; } static inline bool match_facebook_chat(lpi_data_t *data) { /* This rule matches the encrypted traffic sent to facebook chat * clients */ if (!match_ssl(data)) return false; /* Port 5228 is used for this */ if (data->server_port != 8883 && data->client_port != 8883) return false; return true; } static inline bool match_xmpps(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_gtalk(data)) return true; if (match_facebook_chat(data)) return true; return false; } static lpi_module_t lpi_xmpps = { LPI_PROTO_XMPPS, LPI_CATEGORY_CHAT, "XMPPS", 10, match_xmpps }; void register_xmpps(LPIModuleMap *mod_map) { register_protocol(&lpi_xmpps, mod_map); } ================================================ FILE: lib/tcp/lpi_xunlei.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_shuijing_44(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x44, 0x00, 0x00, 0x00)) return true; if (MATCH(payload, 0x42, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_shuijing_3e(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x3e, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_shuijing_41(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x41, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_shuijing_46(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x46, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_shuijing_43(uint32_t payload, uint32_t len) { if (len == 9 && MATCH(payload, 0x43, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_xunlei_3e(uint32_t payload, uint32_t len) { if (len == 132 && MATCH(payload, 0x3e, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_xunlei_36(uint32_t payload, uint32_t len) { if (len == 51 && MATCH(payload, 0x36, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_xunlei(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* if (match_str_both(data, "\x3c\x00\x00\x00", "\x3c\x00\x00\x00")) return true; if (match_str_both(data, "\x3d\x00\x00\x00", "\x39\x00\x00\x00")) return true; if (match_str_both(data, "\x3d\x00\x00\x00", "\x3a\x00\x00\x00")) return true; */ if (match_str_both(data, "\x29\x00\x00\x00", "\x29\x00\x00\x00")) return true; if (match_str_both(data, "\x36\x00\x00\x00", "\x33\x00\x00\x00")) return true; if (match_str_both(data, "\x36\x00\x00\x00", "\x36\x00\x00\x00")) return true; if (match_str_either(data, "\x33\x00\x00\x00")) { if (data->payload_len[0] == 0 && data->payload_len[1] == 87) return true; if (data->payload_len[1] == 0 && data->payload_len[0] == 87) return true; } if (match_str_either(data, "\x36\x00\x00\x00")) { if (data->payload_len[0] == 0 && data->payload_len[1] == 71) return true; if (data->payload_len[1] == 0 && data->payload_len[0] == 71) return true; } if (match_str_either(data, "\x29\x00\x00\x00")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } /* Pretty sure this is "Thunder Crystal" (a.k.a. Xunlei Shuijing), * a P2P approach to doing CDN. Uses TCP port 4593, usually. * Ref: http://dl.acm.org/citation.cfm?id=2736085 * * XXX Should this be a separate protocol? */ if (match_shuijing_44(data->payload[0], data->payload_len[0])) { if (match_shuijing_3e(data->payload[1], data->payload_len[1])) return true; if (match_shuijing_46(data->payload[1], data->payload_len[1])) return true; if (match_shuijing_44(data->payload[1], data->payload_len[1])) return true; if (match_shuijing_43(data->payload[1], data->payload_len[1])) return true; if (match_shuijing_41(data->payload[1], data->payload_len[1])) return true; } if (match_shuijing_44(data->payload[1], data->payload_len[1])) { if (match_shuijing_3e(data->payload[0], data->payload_len[0])) return true; if (match_shuijing_46(data->payload[0], data->payload_len[0])) return true; if (match_shuijing_44(data->payload[0], data->payload_len[0])) return true; if (match_shuijing_43(data->payload[0], data->payload_len[0])) return true; if (match_shuijing_41(data->payload[0], data->payload_len[0])) return true; } /* Almost certainly Xunlei-related, appears on port 8080 to hosts * that are in subnets used by Xunlei. Many IP ranges appear in * http://ipfilter-emule.googlecode.com/svn/trunk/ipfilter-xl/.htaccess?id=htxl * * Update: the above URL no longer exists, but thankfully archive.org * has saved a copy: * http://web.archive.org/web/20160410231755/http://ipfilter-emule.googlecode.com/svn/trunk/ipfilter-xl/.htaccess */ if (match_xunlei_3e(data->payload[0], data->payload_len[0])) { if (match_xunlei_36(data->payload[1], data->payload_len[1])) { return true; } } if (match_xunlei_3e(data->payload[1], data->payload_len[1])) { if (match_xunlei_36(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_xunlei = { LPI_PROTO_XUNLEI, LPI_CATEGORY_P2P, "Xunlei", 3, match_xunlei }; void register_xunlei(LPIModuleMap *mod_map) { register_protocol(&lpi_xunlei, mod_map); } ================================================ FILE: lib/tcp/lpi_xunlei_accel.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* This protocol is definitely tied up with Xunlei. It appears to only be * used when using the "accelerated" download option in the Thunder client. * Basically, the download will be accelerated by pulling parts of the content * from servers owned by Xunlei in addition to the standard P2P downloading * from other Xunlei users. * * Not 100% sure this should be a separate protocol, but the distinction * compared with the other Xunlei stuff is possibly interesting. */ /* NOTE: we see a lot of other xunlei traffic with a similar payload pattern * on other ports but the payload sizes don't match up so I suspect this is * 'other' thunder traffic of some sort. */ static inline bool match_xaccel_req(uint32_t payload, uint32_t len) { uint32_t byte4; /* Byte 4 must be either 0x4X or 0x5X */ byte4 = (ntohl(payload) & 0xff); if (byte4 < 0x40 || byte4 > 0x5f) return false; /* Observed requests seem to fall in a very specific packet size * range (at least the stuff on port 8080 does) */ if (len >= 532 && len <= 542) return true; if (len >= 309 && len <= 312) return true; return false; } static inline bool match_xaccel_resp(uint32_t payload, uint32_t len) { uint32_t byte4; /* Byte 4 must be either 0x4X or 0x5X */ byte4 = (ntohl(payload) & 0xff); if (byte4 < 0x40 || byte4 > 0x5f) return false; /* Observed requests seem to fall in a very specific packet size * range (at least the stuff on port 8080 does) */ if (len >= 104 && len <= 116) return true; return false; } static inline bool match_xunlei_accel(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Tough to match reliably -- we don't have a lot to go on */ /* The Xunlei-controlled servers all seem to listen on port 8080 */ if (data->server_port != 8080 && data->client_port != 8080) return false; if (match_xaccel_req(data->payload[0], data->payload_len[0])) { if (match_xaccel_resp(data->payload[1], data->payload_len[1])) return true; } if (match_xaccel_req(data->payload[1], data->payload_len[1])) { if (match_xaccel_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_xunlei_accel = { LPI_PROTO_XUNLEI_ACCEL, LPI_CATEGORY_P2P, "XunleiAccelerated", 240, match_xunlei_accel }; void register_xunlei_accel(LPIModuleMap *mod_map) { register_protocol(&lpi_xunlei_accel, mod_map); } ================================================ FILE: lib/tcp/lpi_xymon.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_xymon(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Xymon aka "Big Brother" aka "Hobbit" */ /* Runs over port 1984 - clever :) */ if (data->server_port != 1984 && data->client_port != 1984) return false; if (match_chars_either(data, 's', 't', 'a', 't')) return true; return false; } static lpi_module_t lpi_xymon = { LPI_PROTO_XYMON, LPI_CATEGORY_MONITORING, "Xymon", 6, match_xymon }; void register_xymon(LPIModuleMap *mod_map) { register_protocol(&lpi_xymon, mod_map); } ================================================ FILE: lib/tcp/lpi_yahoo.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_yahoo(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Yahoo messenger starts with YMSG */ if (match_str_either(data, "YMSG")) return true; /* Some flows start with YAHO - I'm going to go with my gut instinct */ if (match_str_either(data, "YAHO")) return true; /* Some versions appear to use . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_yahoo_error(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Yahoo seems to respond to HTTP errors in a really odd way - it * opens up a new connection and just sends raw HTML with the * error message in it. Not sure how they expect that to work, though. */ if (data->payload_len[0] != 0 && data->payload_len[1] != 0) return false; /* The html isn't entirely valid either - they start with * rather than ... */ if (match_str_either(data, ". * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* This traffic all seems to go to games.X.yahoo.com, so I'm going to assume * that this is Yahoo Games */ static inline bool match_yahoo_games_req(uint32_t payload, uint32_t len) { if (len != 1) return false; if (!MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return false; return true; } static inline bool match_yahoo_games_resp(uint32_t payload, uint32_t len) { if (len != 22) return false; if (!MATCH(payload, 0x81, 0xd3, 0x70, 0x6c)) return false; return true; } static inline bool match_yahoo_games(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_yahoo_games_req(data->payload[0], data->payload_len[0])) { if (match_yahoo_games_resp(data->payload[1], data->payload_len[1])) { return true; } } if (match_yahoo_games_req(data->payload[1], data->payload_len[1])) { if (match_yahoo_games_resp(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_yahoo_games = { LPI_PROTO_YAHOO_GAMES, LPI_CATEGORY_GAMING, "YahooGames", 4, match_yahoo_games }; void register_yahoo_games(LPIModuleMap *mod_map) { register_protocol(&lpi_yahoo_games, mod_map); } ================================================ FILE: lib/tcp/lpi_yahoo_webcam.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_yahoo_webcam(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, ". * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_youku_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This took a lot of detective work and liberal use of Google * translate to figure out what this protocol this pattern matched */ if (match_youku_payload(data->payload[0], data->payload_len[0])) { if (match_youku_payload(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_youku = { LPI_PROTO_YOUKU, LPI_CATEGORY_STREAMING, "Youku", 4, match_youku_tcp }; void register_youku_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_youku, mod_map); } ================================================ FILE: lib/tcp/lpi_yy_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* YY Live Streaming from China */ /* Unfortunately YY uses a 4 byte length field (albeit in little endian * byte order) so there's a good chance this rule will get a few FPs :/ */ static inline bool match_yy_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_yy_payload(data->payload[0], data->payload_len[0])) { if (match_yy_payload(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_yy_tcp = { LPI_PROTO_YY, LPI_CATEGORY_STREAMING, "YY_TCP", 200, match_yy_tcp }; void register_yy_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_yy_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_zabbix.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_zabbix(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "ZBXD")) return true; /* Everything below this line requires one of the ports to be the * default zabbix port */ if (data->server_port != 10050 && data->client_port != 10050) return false; /* Zabbix Windows performance counters * TODO capture some genuine responses and match on those too */ if (MATCH(data->payload[0], 'p', 'e', 'r', 'f')) return true; if (MATCH(data->payload[1], 'p', 'e', 'r', 'f')) return true; if (MATCH(data->payload[0], 's', 'y', 's', 't')) return true; if (MATCH(data->payload[1], 's', 'y', 's', 't')) return true; return false; } static lpi_module_t lpi_zabbix = { LPI_PROTO_ZABBIX, LPI_CATEGORY_MONITORING, "Zabbix", 5, match_zabbix }; void register_zabbix(LPIModuleMap *mod_map) { register_protocol(&lpi_zabbix, mod_map); } ================================================ FILE: lib/tcp/lpi_zero.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Zero: a modified version of QUIC crypto used by Facebook until TLS 1.3 is * available. * * See http://cryptologie.net/article/321/real-world-crypto-day-2/ for a bit * more detail. */ static inline bool match_zero_fb_chlo(uint32_t payload, uint32_t len) { if (MATCH(payload, '1', 'Q', 'T', 'V')) return true; return false; } static inline bool match_zero_fb_shlo(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, '1', 'Q', 'T', 'V')) return true; if (MATCH(payload, 0x30, ANY, 0x0c, 0x00)) return true; if (MATCH(payload, 0x30, ANY, 0x0d, 0x00)) return true; if (MATCH(payload, 0x30, 0x11, 0x0f, 0x00)) return true; if (MATCH(payload, 0x30, 0x14, 0x05, 0x00)) return true; if (MATCH(payload, 0x30, ANY, 0x00, 0x00)) return true; return false; } static inline bool match_zero_facebook(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 443 && data->client_port != 443) return false; if (match_zero_fb_chlo(data->payload[0], data->payload_len[0])) { if (match_zero_fb_shlo(data->payload[1], data->payload_len[1])) return true; } if (match_zero_fb_chlo(data->payload[1], data->payload_len[1])) { if (match_zero_fb_shlo(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_zero_facebook = { LPI_PROTO_ZERO_FACEBOOK, LPI_CATEGORY_WEB, "Zero_Facebook", 5, match_zero_facebook }; void register_zero_facebook(LPIModuleMap *mod_map) { register_protocol(&lpi_zero_facebook, mod_map); } ================================================ FILE: lib/tcp/lpi_zoom_tcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_zoom_01(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x01, 0x00, 0x6c, 0x00) && len == 111) return true; if (MATCH(payload, 0x01, 0x00, 0x6a, 0x00) && len == 109) return true; if (MATCH(payload, 0x01, 0x00, 0x83, 0x00) && len == 134) return true; return false; } static inline bool match_zoom_02(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x02, 0x00, 0x22, 0x00) && len == 37) return true; if (MATCH(payload, 0x02, 0x00, 0x24, 0x00) && len == 39) return true; return false; } static inline bool match_zoom_tcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 8801 && data->client_port != 8801) { return false; } /* Byte 4 must match in both directions */ if ((data->payload[0] & 0xff000000) != (data->payload[1] & 0xff000000)) return false; if (match_zoom_01(data->payload[0], data->payload_len[0])) { if (match_zoom_02(data->payload[1], data->payload_len[1])) return true; } if (match_zoom_01(data->payload[1], data->payload_len[1])) { if (match_zoom_02(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_zoom_tcp = { LPI_PROTO_ZOOM, LPI_CATEGORY_VOIP, "ZoomTCP", 5, match_zoom_tcp }; void register_zoom_tcp(LPIModuleMap *mod_map) { register_protocol(&lpi_zoom_tcp, mod_map); } ================================================ FILE: lib/tcp/lpi_zynga.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_zynga(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "pres", "3 se")) return true; if (match_str_both(data, "pres", "4 se")) return true; if (match_str_both(data, "imsg", "4 se")) return true; /* Flash facebook games */ if (match_str_both(data, "server_port == 9339 || data->client_port == 9339) return true; } return false; } static lpi_module_t lpi_zynga = { LPI_PROTO_ZYNGA, LPI_CATEGORY_GAMING, "Zynga", 3, match_zynga }; void register_zynga(LPIModuleMap *mod_map) { register_protocol(&lpi_zynga, mod_map); } ================================================ FILE: lib/tcp/tcp_protocols.h ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #ifndef TCP_PROTOCOLS_H_ #define TCP_PROTOCOLS_H_ #include "proto_manager.h" void register_300heroes(LPIModuleMap *mod_map); void register_360safeguard(LPIModuleMap *mod_map); void register_4d(LPIModuleMap *mod_map); void register_acestream(LPIModuleMap *mod_map); void register_afp(LPIModuleMap *mod_map); void register_airdroid(LPIModuleMap *mod_map); void register_airmedia(LPIModuleMap *mod_map); void register_akamai_tcp(LPIModuleMap *mod_map); void register_amp(LPIModuleMap *mod_map); void register_antcoin(LPIModuleMap *mod_map); void register_appearin(LPIModuleMap *mod_map); void register_apple_push(LPIModuleMap *mod_map); void register_ares(LPIModuleMap *mod_map); void register_badbaidu(LPIModuleMap *mod_map); void register_baofeng_tcp(LPIModuleMap *mod_map); void register_beam(LPIModuleMap *mod_map); void register_bitcoin(LPIModuleMap *mod_map); void register_bitextend(LPIModuleMap *mod_map); void register_bittorrent(LPIModuleMap *mod_map); void register_blackdesert(LPIModuleMap *mod_map); void register_blizzard(LPIModuleMap *mod_map); void register_btsync(LPIModuleMap *mod_map); void register_bwsyncandshare(LPIModuleMap *mod_map); void register_cacaoweb(LPIModuleMap *mod_map); void register_cgp(LPIModuleMap *mod_map); void register_chatango(LPIModuleMap *mod_map); void register_cisco_vpn(LPIModuleMap *mod_map); void register_clashofclans(LPIModuleMap *mod_map); void register_classin_tcp(LPIModuleMap *mod_map); void register_clubbox(LPIModuleMap *mod_map); void register_cod_waw(LPIModuleMap *mod_map); void register_conquer(LPIModuleMap *mod_map); void register_crashplan(LPIModuleMap *mod_map); void register_crossfire_tcp(LPIModuleMap *mod_map); void register_cryptic(LPIModuleMap *mod_map); void register_cvs(LPIModuleMap *mod_map); void register_dahua_tcp(LPIModuleMap *mod_map); void register_dash(LPIModuleMap *mod_map); void register_dell_backup(LPIModuleMap *mod_map); void register_destiny(LPIModuleMap *mod_map); void register_diablo3(LPIModuleMap *mod_map); void register_dianping_tcp(LPIModuleMap *mod_map); void register_directconnect(LPIModuleMap *mod_map); void register_dnf(LPIModuleMap *mod_map); void register_dns_tcp(LPIModuleMap *mod_map); void register_dogecoin(LPIModuleMap *mod_map); void register_douyu(LPIModuleMap *mod_map); void register_douyu_chat(LPIModuleMap *mod_map); void register_duelingnetwork(LPIModuleMap *mod_map); void register_dvrns(LPIModuleMap *mod_map); void register_dxp(LPIModuleMap *mod_map); void register_ea_games(LPIModuleMap *mod_map); void register_emule(LPIModuleMap *mod_map); void register_ethernetip(LPIModuleMap *mod_map); void register_eye(LPIModuleMap *mod_map); void register_facebook_turn(LPIModuleMap *mod_map); void register_fb_message(LPIModuleMap *mod_map); void register_fbcdn_ssl(LPIModuleMap *mod_map); void register_ffxiv(LPIModuleMap *mod_map); void register_filenori(LPIModuleMap *mod_map); void register_flash(LPIModuleMap *mod_map); void register_fliggy(LPIModuleMap *mod_map); void register_fring(LPIModuleMap *mod_map); void register_ftpcontrol(LPIModuleMap *mod_map); void register_ftpdata(LPIModuleMap *mod_map); void register_fuckcoin(LPIModuleMap *mod_map); void register_funshion_tcp(LPIModuleMap *mod_map); void register_gamespy_tcp(LPIModuleMap *mod_map); void register_gcafe_updater(LPIModuleMap *mod_map); void register_giop(LPIModuleMap *mod_map); void register_git(LPIModuleMap *mod_map); void register_glupteba(LPIModuleMap *mod_map); void register_gnutella(LPIModuleMap *mod_map); void register_goku(LPIModuleMap *mod_map); void register_googlehangouts(LPIModuleMap *mod_map); void register_graalonlineera(LPIModuleMap *mod_map); void register_guildwars2(LPIModuleMap *mod_map); void register_hamachi(LPIModuleMap *mod_map); void register_harveys(LPIModuleMap *mod_map); void register_hearthstone(LPIModuleMap *mod_map); void register_hola(LPIModuleMap *mod_map); void register_hots_tcp(LPIModuleMap *mod_map); void register_http_badport(LPIModuleMap *mod_map); void register_http(LPIModuleMap *mod_map); void register_http_nonstandard(LPIModuleMap *mod_map); void register_https(LPIModuleMap *mod_map); void register_http_tunnel(LPIModuleMap *mod_map); void register_ica(LPIModuleMap *mod_map); void register_icep(LPIModuleMap *mod_map); void register_id(LPIModuleMap *mod_map); void register_idrivesync(LPIModuleMap *mod_map); void register_ihexin(LPIModuleMap *mod_map); void register_imap(LPIModuleMap *mod_map); void register_imaps(LPIModuleMap *mod_map); void register_imesh(LPIModuleMap *mod_map); void register_invalid(LPIModuleMap *mod_map); void register_invalid_bittorrent(LPIModuleMap *mod_map); void register_invalid_http(LPIModuleMap *mod_map); void register_invalid_pop(LPIModuleMap *mod_map); void register_invalid_smtp(LPIModuleMap *mod_map); void register_ipfs(LPIModuleMap *mod_map); void register_ipop(LPIModuleMap *mod_map); void register_ipsharkk(LPIModuleMap *mod_map); void register_irc(LPIModuleMap *mod_map); void register_java(LPIModuleMap *mod_map); void register_jedi(LPIModuleMap *mod_map); void register_jx3online(LPIModuleMap *mod_map); void register_kakao(LPIModuleMap *mod_map); void register_kankan_tcp(LPIModuleMap *mod_map); void register_kaseya(LPIModuleMap *mod_map); void register_kaspersky(LPIModuleMap *mod_map); void register_kik(LPIModuleMap *mod_map); void register_kingofglory_tcp(LPIModuleMap *mod_map); void register_kuaibo(LPIModuleMap *mod_map); void register_ldap(LPIModuleMap *mod_map); void register_lifeforge(LPIModuleMap *mod_map); void register_line(LPIModuleMap *mod_map); void register_litecoin(LPIModuleMap *mod_map); void register_llp2p(LPIModuleMap *mod_map); void register_maplestory_china(LPIModuleMap *mod_map); void register_maxicloud(LPIModuleMap *mod_map); void register_message4u(LPIModuleMap *mod_map); void register_minecraft(LPIModuleMap *mod_map); void register_mitglieder(LPIModuleMap *mod_map); void register_mms(LPIModuleMap *mod_map); void register_mongo(LPIModuleMap *mod_map); void register_mp2p(LPIModuleMap *mod_map); void register_msn(LPIModuleMap *mod_map); void register_msnc(LPIModuleMap *mod_map); void register_msnv(LPIModuleMap *mod_map); void register_munin(LPIModuleMap *mod_map); void register_mysql(LPIModuleMap *mod_map); void register_mystery_8000(LPIModuleMap *mod_map); void register_mystery_9000(LPIModuleMap *mod_map); void register_mystery_conn(LPIModuleMap *mod_map); void register_mystery_iG(LPIModuleMap *mod_map); void register_mystery_pspr(LPIModuleMap *mod_map); void register_mystery_rxxf(LPIModuleMap *mod_map); void register_mystery_symantec(LPIModuleMap *mod_map); void register_mzinga(LPIModuleMap *mod_map); void register_naverp2p(LPIModuleMap *mod_map); void register_ncsoft(LPIModuleMap *mod_map); void register_ndt_tput(LPIModuleMap *mod_map); void register_netbios(LPIModuleMap *mod_map); void register_netcat_cctv(LPIModuleMap *mod_map); void register_netmfp(LPIModuleMap *mod_map); void register_nntp(LPIModuleMap *mod_map); void register_nntps(LPIModuleMap *mod_map); void register_nomachine(LPIModuleMap *mod_map); void register_norton_backup(LPIModuleMap *mod_map); void register_notes_rpc(LPIModuleMap *mod_map); void register_tcp_no_payload(LPIModuleMap *mod_map); void register_tcp_no_firstpkt(LPIModuleMap *mod_map); void register_nsq(LPIModuleMap *mod_map); void register_omegle(LPIModuleMap *mod_map); void register_openvpn(LPIModuleMap *mod_map); void register_ourworld(LPIModuleMap *mod_map); void register_palringo(LPIModuleMap *mod_map); void register_paltalk(LPIModuleMap *mod_map); void register_pandatv(LPIModuleMap *mod_map); void register_pando(LPIModuleMap *mod_map); void register_pathofexile(LPIModuleMap *mod_map); void register_pdbox(LPIModuleMap *mod_map); void register_pop3(LPIModuleMap *mod_map); void register_pop3s(LPIModuleMap *mod_map); void register_postgresql(LPIModuleMap *mod_map); void register_pptp(LPIModuleMap *mod_map); void register_psn_store(LPIModuleMap *mod_map); void register_qcloud_ilvb(LPIModuleMap *mod_map); void register_qq_tcp(LPIModuleMap *mod_map); void register_qqdownload(LPIModuleMap *mod_map); void register_qqlive_tcp(LPIModuleMap *mod_map); void register_qqspeedmobile_tcp(LPIModuleMap *mod_map); void register_qvod(LPIModuleMap *mod_map); void register_rabbitmq(LPIModuleMap *mod_map); void register_ragnarokonline(LPIModuleMap *mod_map); void register_razor(LPIModuleMap *mod_map); void register_rbls(LPIModuleMap *mod_map); void register_rdp(LPIModuleMap *mod_map); void register_realmofthemadgod(LPIModuleMap *mod_map); void register_realvnc(LPIModuleMap *mod_map); void register_rejection(LPIModuleMap *mod_map); void register_relay(LPIModuleMap *mod_map); void register_remote_manipulator(LPIModuleMap *mod_map); void register_revolver_nblbt(LPIModuleMap *mod_map); void register_rfb(LPIModuleMap *mod_map); void register_rpcscan(LPIModuleMap *mod_map); void register_rrtv(LPIModuleMap *mod_map); void register_rsync(LPIModuleMap *mod_map); void register_rtmp(LPIModuleMap *mod_map); void register_rtsp(LPIModuleMap *mod_map); void register_runescape(LPIModuleMap *mod_map); void register_s7comm(LPIModuleMap *mod_map); void register_saprouter(LPIModuleMap *mod_map); void register_saszombieassault4(LPIModuleMap *mod_map); void register_second_life(LPIModuleMap *mod_map); void register_shoutcast(LPIModuleMap *mod_map); void register_silkroadonline(LPIModuleMap *mod_map); void register_sip(LPIModuleMap *mod_map); void register_skyforge(LPIModuleMap *mod_map); void register_skype_tcp(LPIModuleMap *mod_map); void register_smb(LPIModuleMap *mod_map); void register_smite_tcp(LPIModuleMap *mod_map); void register_smtp(LPIModuleMap *mod_map); void register_smtps(LPIModuleMap *mod_map); void register_socks4(LPIModuleMap *mod_map); void register_socks5(LPIModuleMap *mod_map); void register_spdy(LPIModuleMap *mod_map); void register_speedify(LPIModuleMap *mod_map); void register_speedin(LPIModuleMap *mod_map); void register_speedtest(LPIModuleMap *mod_map); void register_spotify(LPIModuleMap *mod_map); void register_ssh(LPIModuleMap *mod_map); void register_ssjj(LPIModuleMap *mod_map); void register_ssl(LPIModuleMap *mod_map); void register_steam(LPIModuleMap *mod_map); void register_stratum(LPIModuleMap *mod_map); void register_stun_tcp(LPIModuleMap *mod_map); void register_supl(LPIModuleMap *mod_map); void register_svn(LPIModuleMap *mod_map); void register_talesrunner(LPIModuleMap *mod_map); void register_tankionline(LPIModuleMap *mod_map); void register_tankix(LPIModuleMap *mod_map); void register_taobao(LPIModuleMap *mod_map); void register_tds(LPIModuleMap *mod_map); void register_teamviewer(LPIModuleMap *mod_map); void register_telecomkey(LPIModuleMap *mod_map); void register_telegram(LPIModuleMap *mod_map); void register_telnet(LPIModuleMap *mod_map); void register_telnet_exploit(LPIModuleMap *mod_map); void register_tencent_games(LPIModuleMap *mod_map); void register_tenfivecoin(LPIModuleMap *mod_map); void register_tensafe(LPIModuleMap *mod_map); void register_tera(LPIModuleMap *mod_map); void register_tetrisonline(LPIModuleMap *mod_map); void register_thedivision(LPIModuleMap *mod_map); void register_tip(LPIModuleMap *mod_map); void register_tor(LPIModuleMap *mod_map); void register_tpkt_generic(LPIModuleMap *mod_map); void register_trackmania(LPIModuleMap *mod_map); void register_transocks(LPIModuleMap *mod_map); void register_trion(LPIModuleMap *mod_map); void register_trojan_win32_generic_sb(LPIModuleMap *mod_map); void register_trojan_zeroaccess(LPIModuleMap *mod_map); void register_twitcasting(LPIModuleMap *mod_map); void register_twitch_irc(LPIModuleMap *mod_map); void register_utherverse(LPIModuleMap *mod_map); void register_vainglory(LPIModuleMap *mod_map); void register_vhdp2p(LPIModuleMap *mod_map); void register_viber(LPIModuleMap *mod_map); void register_vmware(LPIModuleMap *mod_map); void register_vodlocker(LPIModuleMap *mod_map); void register_vpnrobot_tcp(LPIModuleMap *mod_map); void register_vpnunlimited_tcp(LPIModuleMap *mod_map); void register_warcraft3(LPIModuleMap *mod_map); void register_web_junk(LPIModuleMap *mod_map); void register_webex_stun(LPIModuleMap *mod_map); void register_weblogic(LPIModuleMap *mod_map); void register_wechat(LPIModuleMap *mod_map); void register_weibo(LPIModuleMap *mod_map); void register_weiqi(LPIModuleMap *mod_map); void register_whatsapp(LPIModuleMap *mod_map); void register_whois(LPIModuleMap *mod_map); void register_winmx(LPIModuleMap *mod_map); void register_wizard101(LPIModuleMap *mod_map); void register_wns(LPIModuleMap *mod_map); void register_wow(LPIModuleMap *mod_map); void register_wuala(LPIModuleMap *mod_map); void register_xiami(LPIModuleMap *mod_map); void register_xmpp(LPIModuleMap *mod_map); void register_xmpps(LPIModuleMap *mod_map); void register_xunlei(LPIModuleMap *mod_map); void register_xunlei_accel(LPIModuleMap *mod_map); void register_xymon(LPIModuleMap *mod_map); void register_yahoo(LPIModuleMap *mod_map); void register_yahoo_error(LPIModuleMap *mod_map); void register_yahoo_games(LPIModuleMap *mod_map); void register_yahoo_webcam(LPIModuleMap *mod_map); void register_youku_tcp(LPIModuleMap *mod_map); void register_yy_tcp(LPIModuleMap *mod_map); void register_zabbix(LPIModuleMap *mod_map); void register_zero_facebook(LPIModuleMap *mod_map); void register_zoom_tcp(LPIModuleMap *mod_map); void register_zynga(LPIModuleMap *mod_map); #endif ================================================ FILE: lib/udp/Makefile.am ================================================ noinst_LTLIBRARIES = libprotoident_udp.la libprotoident_udp_la_SOURCES = \ lpi_360cn.cc \ lpi_360p2p.cc \ lpi_aachen_udp.cc \ lpi_acercloud.cc \ lpi_akamai.cc \ lpi_akamai_transfer.cc \ lpi_amanda.cc \ lpi_apple_facetime_init.cc \ lpi_ard.cc \ lpi_ares.cc \ lpi_ark.cc \ lpi_arma_server.cc \ lpi_arma3_server.cc \ lpi_artcp.cc \ lpi_assettocorsa.cc \ lpi_avast_secure_dns.cc \ lpi_backweb.cc \ lpi_bacnet.cc \ lpi_baiduyun_p2p.cc \ lpi_baofeng_udp.cc \ lpi_battlefield.cc \ lpi_bjnp.cc \ lpi_bmdp.cc \ lpi_btsync.cc \ lpi_cacaoweb_udp.cc \ lpi_canon_mfnp.cc \ lpi_chargen_exploit.cc \ lpi_checkpoint_rdp.cc \ lpi_chivalry.cc \ lpi_ethernetip.cc \ lpi_cip_io.cc \ lpi_cirn.cc \ lpi_cisco_ipsec.cc \ lpi_cisco_sslvpn.cc \ lpi_classin_udp.cc \ lpi_cloudflare_warp.cc \ lpi_cod.cc \ lpi_codmobile.cc \ lpi_combatarms.cc \ lpi_combatarms_p2p.cc \ lpi_contract_wars.cc \ lpi_crossfire.cc \ lpi_crossout.cc \ lpi_csgo.cc \ lpi_csoriginal.cc \ lpi_dahua.cc \ lpi_db2.cc \ lpi_dcc.cc \ lpi_demonware.cc \ lpi_destiny_udp.cc \ lpi_dhcp.cc \ lpi_dht_dict.cc \ lpi_dht_other.cc \ lpi_diablo2.cc \ lpi_dianping_udp.cc \ lpi_dianshijia.cc \ lpi_directconnect.cc \ lpi_discord.cc \ lpi_dns.cc \ lpi_dota2.cc \ lpi_doyo.cc \ lpi_driveshare.cc \ lpi_dtls.cc \ lpi_emule.cc \ lpi_emule_weak.cc \ lpi_epson.cc \ lpi_eso.cc \ lpi_esp_encap.cc \ lpi_eye.cc \ lpi_fasp.cc \ lpi_feitwo.cc \ lpi_forticlient_sslvpn.cc \ lpi_fortinet.cc \ lpi_foscam.cc \ lpi_freechal.cc \ lpi_freefire.cc \ lpi_funshion.cc \ lpi_gamespy.cc \ lpi_ganglia.cc \ lpi_gangsofspace.cc \ lpi_garena.cc \ lpi_gearsofwar.cc \ lpi_gnutella.cc \ lpi_gnutella2.cc \ lpi_gnutella_weak.cc \ lpi_gotomeeting.cc \ lpi_gprs_tunnel.cc \ lpi_gsm.cc \ lpi_h1z1.cc \ lpi_halflife.cc \ lpi_haloonline.cc \ lpi_hamachi.cc \ lpi_heroesevolved.cc \ lpi_heroes_generals.cc \ lpi_heliborne.cc \ lpi_hollachat.cc \ lpi_hots.cc \ lpi_icp.cc \ lpi_imesh.cc \ lpi_ipmsg.cc \ lpi_ipv6.cc \ lpi_isakmp.cc \ lpi_jedi.cc \ lpi_jedi_academy.cc \ lpi_kademlia.cc \ lpi_kankan.cc \ lpi_kaspersky.cc \ lpi_kazaa.cc \ lpi_kingofglory_udp.cc \ lpi_kuguo.cc \ lpi_l2tp.cc \ lpi_lansync.cc \ lpi_ldap_ad.cc \ lpi_line_udp.cc \ lpi_linkproof.cc \ lpi_loadout.cc \ lpi_lol.cc \ lpi_mdns.cc \ lpi_merakicloud.cc \ lpi_moh.cc \ lpi_moonhunters.cc \ lpi_mp2p.cc \ lpi_msn_cache.cc \ lpi_msn_video.cc \ lpi_msoffice_mac.cc \ lpi_mta.cc \ lpi_mystery_05.cc \ lpi_mystery_0660.cc \ lpi_mystery_0d.cc \ lpi_mystery_45.cc \ lpi_mystery_61_72.cc \ lpi_mystery_8000.cc \ lpi_mystery_99.cc \ lpi_mystery_e9.cc \ lpi_mystery_qq.cc \ lpi_n2ping.cc \ lpi_natpmp.cc \ lpi_netbios.cc \ lpi_netcat_cctv_udp.cc \ lpi_netcore_scan.cc \ lpi_netflow.cc \ lpi_newerth.cc \ lpi_nintendo.cc \ lpi_noction.cc \ lpi_noe.cc \ lpi_nopayload.cc \ lpi_norton.cc \ lpi_ntp.cc \ lpi_ntp_reflect.cc \ lpi_nwn.cc \ lpi_nvidia_gamestream.cc \ lpi_opaserv.cc \ lpi_openvpn.cc \ lpi_orbit.cc \ lpi_overwatch.cc \ lpi_paladins.cc \ lpi_pando.cc \ lpi_panipani.cc \ lpi_planetside2.cc \ lpi_portmap_rpc.cc \ lpi_pplive.cc \ lpi_ppstream.cc \ lpi_probable_gnutella.cc \ lpi_ps4_remoteplay.cc \ lpi_psn.cc \ lpi_punkbuster.cc \ lpi_pyzor.cc \ lpi_qq.cc \ lpi_qqlive.cc \ lpi_qqpcmgr.cc \ lpi_qqspeedmobile_udp.cc \ lpi_quake.cc \ lpi_quic.cc \ lpi_qvod_udp.cc \ lpi_radius.cc \ lpi_ramseydash.cc \ lpi_rdp_udp.cc \ lpi_real.cc \ lpi_risingstorm.cc \ lpi_raknet.cc \ lpi_robocraft.cc \ lpi_rocket_league.cc \ lpi_rrshare.cc \ lpi_rtcp.cc \ lpi_rtmfp.cc \ lpi_rtp.cc \ lpi_rulesofsurvival.cc \ lpi_sanandreas_mp.cc \ lpi_second_life.cc \ lpi_serialnumberd.cc \ lpi_sip.cc \ lpi_skype.cc \ lpi_slp.cc \ lpi_smite.cc \ lpi_snapvpn.cc \ lpi_snmp.cc \ lpi_sopcast.cc \ lpi_spamfighter.cc \ lpi_spotify_bcast.cc \ lpi_sql_worm.cc \ lpi_ssdp.cc \ lpi_starcitizen.cc \ lpi_starcraft.cc \ lpi_starleaf.cc \ lpi_steam.cc \ lpi_steamfriends.cc \ lpi_steam_inhomebroadcast.cc \ lpi_steam_localbroadcast.cc \ lpi_storm_worm.cc \ lpi_stun.cc \ lpi_syslog.cc \ lpi_talesrunner_udp.cc \ lpi_teamspeak.cc \ lpi_teamviewer.cc \ lpi_teredo.cc \ lpi_tf2.cc \ lpi_tftp.cc \ lpi_thecrew.cc \ lpi_thq.cc \ lpi_torchlight2.cc \ lpi_tox.cc \ lpi_traceroute.cc \ lpi_tremulous.cc \ lpi_turbovpn.cc \ lpi_tvants.cc \ lpi_ubisoft_games.cc \ lpi_umeye.cc \ lpi_unreal.cc \ lpi_ventrilo.cc \ lpi_viber.cc \ lpi_vivox.cc \ lpi_vpnmaster.cc \ lpi_vpnrobot_udp.cc \ lpi_vxworks_exploit.cc \ lpi_warthunder.cc \ lpi_webex.cc \ lpi_wechat_udp.cc \ lpi_winmessage.cc \ lpi_wireguard.cc \ lpi_wolfet.cc \ lpi_worm_22105.cc \ lpi_xfire_p2p.cc \ lpi_xlsp.cc \ lpi_xunlei.cc \ lpi_xunlei_jsq.cc \ lpi_xunyou.cc \ lpi_youdao_dict.cc \ lpi_youku.cc \ lpi_yuanfudao.cc \ lpi_yy_udp.cc \ lpi_zalo_call.cc \ lpi_zeroaccess_udp.cc \ lpi_zoom.cc EXTRA_DIST=udp_protocols.h libprotoident_udp_la_CFLAGS=-I"$(top_srcdir)/lib" libprotoident_udp_la_CPPFLAGS=-I"$(top_srcdir)/lib" INCLUDES=@ADD_INCLS@ ================================================ FILE: lib/udp/lpi_360cn.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Not 100% sure what this is but: * - it's on port 53 but is definitely not DNS * - involves servers owned by 360.cn, who 'supposedly' are antivirus experts * - the protocol appears to be a custom encryption protocol */ static inline bool match_360cn_0102(uint32_t a, uint32_t b) { if (a != b) return false; if (MATCH(a, ANY, ANY, 0x01, 0x02)) return true; return false; } static inline bool match_360cn_0a04(uint32_t pload, uint32_t len) { uint32_t hdrlen = (ntohl(pload)) & 0xffff; if (len == 0) return true; if (!MATCH(pload, 0x0a, 0x04, ANY, ANY)) return false; if (hdrlen + 10 == len) return true; return false; } static inline bool match_360cn(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 53 && data->client_port != 53) return false; if (match_360cn_0102(data->payload[0], data->payload[1])) return true; if (match_360cn_0a04(data->payload[0], data->payload_len[0])) { if (match_360cn_0a04(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_360cn = { LPI_PROTO_UDP_360CN, LPI_CATEGORY_SECURITY, "360.cn", 50, match_360cn }; void register_360cn(LPIModuleMap *mod_map) { register_protocol(&lpi_360cn, mod_map); } ================================================ FILE: lib/udp/lpi_360p2p.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_360p2p_request(uint32_t payload, uint32_t len) { if (len == 72 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; if (len == 40 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_360p2p_reply(uint32_t payload, uint32_t len) { if (len == 40 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; if (len == 30 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; if (len == 50 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; if (len == 72 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_360p2p(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_360p2p_request(data->payload[0], data->payload_len[0])) { if (match_360p2p_reply(data->payload[1], data->payload_len[1])) return true; } if (match_360p2p_request(data->payload[1], data->payload_len[1])) { if (match_360p2p_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_360p2p = { LPI_PROTO_UDP_360P2P, LPI_CATEGORY_SECURITY, "360Safeguard_P2P", 211, match_360p2p }; void register_360p2p(LPIModuleMap *mod_map) { register_protocol(&lpi_360p2p, mod_map); } ================================================ FILE: lib/udp/lpi_aachen_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_aachen_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Regular UDP port 80 and port 443 probes from RWTH-Aachen University * for research purposes. See http://137.226.113.7/ for more details. */ if (data->server_port == 80 || data->client_port == 80 || data->server_port == 443 || data->client_port == 443) { if (data->payload_len[0] == 0) { if (data->payload_len[1] != 1055) return false; if (MATCH(data->payload[1], 0x0d, 'S', 'C', 'A')) return true; } if (data->payload_len[1] == 0) { if (data->payload_len[0] != 1055) return false; if (MATCH(data->payload[0], 0x0d, 'S', 'C', 'A')) return true; } } return false; } static lpi_module_t lpi_aachen_udp = { LPI_PROTO_UDP_RWTH_AACHEN, LPI_CATEGORY_MONITORING, "RWTHAachenScan", 100, match_aachen_udp }; void register_aachen_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_aachen_udp, mod_map); } ================================================ FILE: lib/udp/lpi_acercloud.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_acer_ff99(uint32_t payload, uint32_t len) { if (len == 102 && MATCHSTR(payload, "\xff\xff\xff\x99")) return true; return false; } static inline bool match_acercloud(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_acer_ff99(data->payload[0], data->payload_len[0])) { if (match_acer_ff99(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_acercloud = { LPI_PROTO_UDP_ACERCLOUD, LPI_CATEGORY_CLOUD, "AcerCloud", 6, match_acercloud }; void register_acercloud(LPIModuleMap *mod_map) { register_protocol(&lpi_acercloud, mod_map); } ================================================ FILE: lib/udp/lpi_akamai.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_akamai(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This appears to be some sort of protocol used by Akamai nodes * to talk to one another - probably the monitoring for the Akamai * network */ /* All messages begin with 8 bytes of zeroes */ if (data->payload[0] != 0 || data->payload[1] != 0) return false; if (data->payload_len[0] == 1080 && data->payload_len[1] == 0) return true; if (data->payload_len[1] == 1080 && data->payload_len[0] == 0) return true; if (data->payload_len[0] == 1032) { if (data->payload_len[1] == 0) return true; if (data->payload_len[1] == 1032) return true; } if (data->payload_len[1] == 1032) { if (data->payload_len[0] == 0) return true; } return false; } static lpi_module_t lpi_akamai = { LPI_PROTO_UDP_AKAMAI, LPI_CATEGORY_MONITORING, "Akamai", 5, match_akamai }; void register_akamai(LPIModuleMap *mod_map) { register_protocol(&lpi_akamai, mod_map); } ================================================ FILE: lib/udp/lpi_akamai_transfer.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static bool match_akamai_out(uint32_t payload, uint32_t len) { if (len < 200) return false; if (MATCH(payload, 0x02, 0x24, ANY, ANY)) return true; return false; } static inline bool match_akamai_transfer(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This protocol is used by Akamai boxes to transfer large quantities * of data back to the main Akamai network. This involves a one-way * UDP flow */ /* Restrict based on port number, because this rule is a bit weak */ if (data->server_port != 1485 && data->client_port != 1485) return false; if (match_akamai_out(data->payload[0], data->payload_len[0])) { if (data->payload_len[1] == 0) return true; } if (match_akamai_out(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] == 0) return true; } return false; } static lpi_module_t lpi_akamai_transfer = { LPI_PROTO_UDP_AKAMAI_TRANSFER, LPI_CATEGORY_CDN, "AkamaiTransfer", 15, match_akamai_transfer }; void register_akamai_transfer(LPIModuleMap *mod_map) { register_protocol(&lpi_akamai_transfer, mod_map); } ================================================ FILE: lib/udp/lpi_amanda.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_amanda(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "Aman")) return true; return false; } static lpi_module_t lpi_amanda = { LPI_PROTO_UDP_AMANDA, LPI_CATEGORY_FILES, "AmandaUDP", 6, match_amanda }; void register_amanda(LPIModuleMap *mod_map) { register_protocol(&lpi_amanda, mod_map); } ================================================ FILE: lib/udp/lpi_apple_facetime_init.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Protocol used to talk to Apple servers when commencing a Facetime call. * iMessage may also use this protocol to determine whether iMessage is * available between two devices. * May also be used by Game Center (but this is not verified). * * NOTE: this protocol is not used for the actual Facetime call itself - that * is done via RTP, SIP and other standard protocols. */ static inline bool match_afi_server_port(uint16_t port) { if (port < 16384) return false; if (port > 16387) return false; return true; } static inline bool match_afi_client_port(uint16_t port) { if (port < 16402) return false; if (port > 16410) return false; return true; } static inline bool match_facetime_req(uint32_t payload, uint32_t len) { if (len != 16) return false; if (MATCH(payload, 0x00, 0x01, 0x00, 0x02)) return true; if (MATCH(payload, 0x00, 0x00, 0x00, 0x02)) return true; return false; } static inline bool match_facetime_resp(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len != 16) return false; if (MATCH(payload, 0x00, 0x01, 0x00, 0x01)) return true; if (MATCH(payload, 0x00, 0x00, 0x00, 0x01)) return true; return false; } static inline bool match_apple_facetime_init(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_afi_server_port(data->server_port) && !match_afi_client_port(data->server_port)) { return false; } if (!match_afi_server_port(data->client_port) && !match_afi_client_port(data->client_port)) { return false; } if (match_facetime_req(data->payload[0], data->payload_len[0])) { if (match_facetime_resp(data->payload[1], data->payload_len[1])) return true; } if (match_facetime_req(data->payload[1], data->payload_len[1])) { if (match_facetime_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_apple_facetime_init = { LPI_PROTO_UDP_APPLE_FACETIME_INIT, LPI_CATEGORY_NAT, // Unsure about this one... "AppleFacetimeInit", 16, match_apple_facetime_init }; void register_apple_facetime_init(LPIModuleMap *mod_map) { register_protocol(&lpi_apple_facetime_init, mod_map); } ================================================ FILE: lib/udp/lpi_ard.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Apple Remote Desktop protocol, generally used to remotely manage Macs. * Probably shouldn't be seen on the Internet, particularly with the patterns * presented here as this was almost certainly a case where a Mac with remote * management enabled was being abused into performing an amplification attack. * * Of course, being Apple, there is no public documentation of this protocol * anywhere so it's pretty hard to write rules that cover legitimate uses of * this protocol. */ static inline bool match_ard_tiny_req(uint32_t payload, uint32_t len) { if (len == 5 && MATCH(payload, 0x00, 0x14, 0x00, 0x01)) { return true; } return false; } static inline bool match_ard_large_resp(uint32_t payload, uint32_t len) { /* Match the case where the client doesn't reply (i.e. participate * in the amplification attack). */ if (len == 0) { return true; } /* All my examples were 1006 bytes, but that's just from one * specific machine */ if (len < 1000) { return false; } if ((ntohl(payload) & 0x0000ffff) != len - 4) { return false; } if (MATCH(payload, 0x00, 0x01, ANY, ANY)) { return true; } return false; } static inline bool match_ard(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 3283 && data->client_port != 3283) { return false; } if (match_ard_tiny_req(data->payload[0], data->payload_len[0])) { if (match_ard_large_resp(data->payload[1], data->payload_len[1])) { return true; } } if (match_ard_tiny_req(data->payload[1], data->payload_len[1])) { if (match_ard_large_resp(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_ard = { LPI_PROTO_UDP_ARD, LPI_CATEGORY_REMOTE, "ARD", 20, match_ard }; void register_ard(LPIModuleMap *mod_map) { register_protocol(&lpi_ard, mod_map); } ================================================ FILE: lib/udp/lpi_ares.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ares_client(uint32_t payload, uint32_t len) { if (len != 3) return false; if (!MATCH(payload, 0x00, ANY, ANY, 0x00)) return false; return true; } static inline bool match_ares_peer(uint32_t payload, uint32_t len) { if (len != 3) return false; if (!MATCH(payload, 0x01, ANY, ANY, 0x00)) return false; return true; } static inline bool match_ares_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_ares_client(data->payload[0], data->payload_len[0])) { if (match_ares_peer(data->payload[1], data->payload_len[1])) return true; } if (match_ares_client(data->payload[1], data->payload_len[1])) { if (match_ares_peer(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_ares_udp = { LPI_PROTO_UDP_ARES, LPI_CATEGORY_P2P, "Ares_UDP", 9, match_ares_udp }; void register_ares_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_ares_udp, mod_map); } ================================================ FILE: lib/udp/lpi_ark.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ark_request(uint32_t payload, uint32_t len) { if (len == 38 && MATCH(payload, 0x00, 0x80, 0x05, 0x00)) return true; return false; } static inline bool match_ark_response(uint32_t payload, uint32_t len) { if (len == 26 && MATCH(payload, 0x00, 0x00, 0x01, 0x00)) return true; return false; } static inline bool match_arksurvival(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_ark_request(data->payload[0], data->payload_len[0])) { if (match_ark_response(data->payload[1], data->payload_len[1])) return true; } if (match_ark_request(data->payload[1], data->payload_len[1])) { if (match_ark_response(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_arksurvival = { LPI_PROTO_UDP_ARK_SURVIVAL, LPI_CATEGORY_GAMING, "ARKSurvivalEvolved", 20, match_arksurvival }; void register_arksurvival(LPIModuleMap *mod_map) { register_protocol(&lpi_arksurvival, mod_map); } ================================================ FILE: lib/udp/lpi_arma3_server.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_arma3_server_payload(uint32_t payload, uint32_t len) { uint32_t replen; if (len == 0) return true; replen = (payload & 0xffff); if (replen != len) return false; if (MATCH(payload, ANY, ANY, 0xe2, 0x16)) return true; if (MATCH(payload, ANY, ANY, 0x60, 0xcf)) return true; return false; } static inline bool match_arma_port_range(lpi_data_t *data) { if (data->server_port >= 2300 && data->server_port <= 2400) return true; if (data->client_port >= 2300 && data->client_port <= 2400) return true; return false; } static inline bool match_arma3_server(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_arma3_server_payload(data->payload[0], data->payload_len[0])) { if (match_arma3_server_payload(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_arma3_server = { LPI_PROTO_UDP_ARMA3_SERVER, LPI_CATEGORY_GAMING, "ARMA3Server", 4, match_arma3_server }; void register_arma3_server(LPIModuleMap *mod_map) { register_protocol(&lpi_arma3_server, mod_map); } ================================================ FILE: lib/udp/lpi_arma_server.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_arma_server_payload(uint32_t payload, uint32_t len) { uint32_t replen; if (len == 0) return true; if (!MATCH(payload, ANY, ANY, 0x01, 0x08)) return false; replen = (payload & 0xffff); if (replen != len) return false; return true; } static inline bool match_arma_nine(uint32_t payload, uint32_t len) { /* The HalfLife protocol and its derivatives all use a similar * type of packet -- probably a server ping probe? * This is probably copied or heavily influenced by that. */ if (len != 9) return false; if (MATCHSTR(payload, "\xff\xff\xff\xff")) return true; return false; } static inline bool match_arma_port_range(lpi_data_t *data) { if (data->server_port >= 2300 && data->server_port <= 2400) return true; if (data->client_port >= 2300 && data->client_port <= 2400) return true; return false; } static inline bool match_arma_server(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_arma_server_payload(data->payload[0], data->payload_len[0])) { if (match_arma_server_payload(data->payload[1], data->payload_len[1])) return true; } /* The next rule is prone to conflicts so restrict to flows that * are using common ARMA ports */ if (!match_arma_port_range(data)) return false; if (match_arma_nine(data->payload[0], data->payload_len[0])) { if (match_arma_nine(data->payload[1], data->payload_len[1])) { return true; } } return false; } static lpi_module_t lpi_arma_server = { LPI_PROTO_UDP_ARMA_SERVER, LPI_CATEGORY_GAMING, "ARMA2Server", 4, match_arma_server }; void register_arma_server(LPIModuleMap *mod_map) { register_protocol(&lpi_arma_server, mod_map); } ================================================ FILE: lib/udp/lpi_artcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Custom version of RTCP used by Alibaba cloud for streaming */ static inline bool match_artcp_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 0x83, 0xcc, 0x00, ANY)) return true; return false; } static inline bool match_artcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port == 1106 || data->client_port == 1106) { if (!match_artcp_payload(data->payload[0], data->payload_len[0])) return false; if (!match_artcp_payload(data->payload[1], data->payload_len[1])) return false; return true; } return false; } static lpi_module_t lpi_artcp = { LPI_PROTO_UDP_ARTCP, LPI_CATEGORY_STREAMING, "ARTCP", 200, match_artcp }; void register_artcp(LPIModuleMap *mod_map) { register_protocol(&lpi_artcp, mod_map); } ================================================ FILE: lib/udp/lpi_assettocorsa.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* A multiplayer car racing sim -- costs $$ to play so unconfirmed but * supporting evidence is strong */ static inline bool match_ac_two(uint32_t payload, uint32_t len) { /* ANY is usually between 0x00 and 0x18 */ if (len == 2 && MATCH(payload, 0x4e, ANY, 0x00, 0x00)) return true; return false; } static inline bool match_ac_one(uint32_t payload, uint32_t len) { if (len == 1 && MATCH(payload, 0x4e, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_assettocorsa(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_ac_two(data->payload[0], data->payload_len[0])) { if (match_ac_one(data->payload[1], data->payload_len[1])) return true; } if (match_ac_one(data->payload[0], data->payload_len[0])) { if (match_ac_two(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_assettocorsa = { LPI_PROTO_UDP_ASSETTO_CORSA, LPI_CATEGORY_GAMING, "AssettoCorsa", 200, match_assettocorsa }; void register_assettocorsa(LPIModuleMap *mod_map) { register_protocol(&lpi_assettocorsa, mod_map); } ================================================ FILE: lib/udp/lpi_avast_secure_dns.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_asd_reply(uint32_t payload) { if (MATCH(payload, 'r', '6', 'f', 'n')) return true; return false; } static inline bool match_asd_request(uint32_t payload) { if (MATCH(payload, '7', 'P', 'Y', 'q')) return true; return false; } static inline bool match_avast_secure_dns(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 53 && data->client_port != 53 && data->server_port != 443 && data->client_port != 443) { return false; } if (match_asd_request(data->payload[0])) { if (match_asd_reply(data->payload[1])) return true; } if (match_asd_request(data->payload[1])) { if (match_asd_reply(data->payload[0])) return true; } /* The requests have no obvious pattern, except being always 512 * bytes. */ if (match_asd_reply(data->payload[0]) && data->payload_len[1] == 512) return true; if (match_asd_reply(data->payload[1]) && data->payload_len[0] == 512) return true; if (data->server_port == 443 || data->client_port == 443) { if (match_dns(data)) { return true; } } return false; } static lpi_module_t lpi_avast_secure_dns = { LPI_PROTO_UDP_AVAST_DNS, LPI_CATEGORY_SERVICES, "AvastSecureDNS", 14, match_avast_secure_dns }; void register_avast_secure_dns(LPIModuleMap *mod_map) { register_protocol(&lpi_avast_secure_dns, mod_map); } ================================================ FILE: lib/udp/lpi_backweb.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_backweb(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 370 && data->client_port != 370) return false; if (match_chars_either(data, 0x21, 0x24, 0x00, ANY)) return true; return false; } static lpi_module_t lpi_backweb = { LPI_PROTO_UDP_BACKWEB, LPI_CATEGORY_SECURITY, "BackWeb", 5, match_backweb }; void register_backweb(LPIModuleMap *mod_map) { register_protocol(&lpi_backweb, mod_map); } ================================================ FILE: lib/udp/lpi_bacnet.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_bacnet_request(uint32_t payload, uint32_t len) { uint32_t baclen = (ntohl(payload) & 0xffff); if (baclen == len && MATCH(payload, 0x81, 0x0a, ANY, ANY)) return true; return false; } static inline bool match_bacnet(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 47808 && data->client_port != 47808) return false; /* I've only seen scans for this stuff, so don't know what a reply * would look like */ if (match_bacnet_request(data->payload[0], data->payload_len[0])) { if (data->payload_len[1] == 0) return true; } if (match_bacnet_request(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] == 0) return true; } return false; } static lpi_module_t lpi_bacnet = { LPI_PROTO_UDP_BACNET, LPI_CATEGORY_REMOTE, /* XXX Create a new category for building * automation?? */ "BACnet", 23, match_bacnet }; void register_bacnet(LPIModuleMap *mod_map) { register_protocol(&lpi_bacnet, mod_map); } ================================================ FILE: lib/udp/lpi_baiduyun_p2p.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Protocol used by Baidu Yun for sharing files between friends. Not * 100% confirmed, but I've managed to observe other confirmed Baidu Yun * traffic for the same host / port prior to the suspected peer starting * flows matching this pattern. * * For some reason I was unable to make P2P transfers work when using Baidu * Yun myself (possibly because I was behind NAT?), which is why I haven't * been able to confirm. */ static inline bool match_byun_p2p(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len == 64 || len == 32 || len == 50) { if (MATCH(payload, 0x01, ANY, ANY, ANY)) return true; } return false; } static inline bool match_baiduyun_p2p(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* if (data->server_port != 7273 && data->client_port != 7273 && data->server_port != 7274 && data->client_port != 7274) return false; */ if (match_byun_p2p(data->payload[0], data->payload_len[0])) { if (match_byun_p2p(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_baiduyun_p2p = { LPI_PROTO_UDP_BAIDU_YUN_P2P, LPI_CATEGORY_P2P, "BaiduYunP2P", 220, match_baiduyun_p2p }; void register_baiduyun_p2p(LPIModuleMap *mod_map) { register_protocol(&lpi_baiduyun_p2p, mod_map); } ================================================ FILE: lib/udp/lpi_baofeng_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_bao(uint32_t payload, uint32_t len) { uint32_t first = ntohl(payload) >> 24; if (len < 38 || len > 55) return false; /* First byte always begins with 0x2X or 0x3X */ if (first < 0x20 || first > 0x3f) return false; return true; } static inline bool match_baofeng_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 9909 && data->client_port != 9909) return false; if (match_bao(data->payload[0], data->payload_len[0])) { if (match_bao(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_baofeng_udp = { LPI_PROTO_UDP_BAOFENG, LPI_CATEGORY_STREAMING, "Baofeng", 105, match_baofeng_udp }; void register_baofeng_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_baofeng_udp, mod_map); } ================================================ FILE: lib/udp/lpi_battlefield.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_battlefield(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Server browsing for battlefield 1942 */ if (match_str_both(data, "ping", "Ping")) return true; if (MATCHSTR(data->payload[0], "ping")) { if (data->payload_len[0] != 5) return false; if (data->payload_len[1] == 0) return true; } if (MATCHSTR(data->payload[1], "ping")) { if (data->payload_len[1] != 5) return false; if (data->payload_len[0] == 0) return true; } return false; } static lpi_module_t lpi_battlefield = { LPI_PROTO_UDP_BATTLEFIELD, LPI_CATEGORY_GAMING, "Battlefield", 7, match_battlefield }; void register_battlefield(LPIModuleMap *mod_map) { register_protocol(&lpi_battlefield, mod_map); } ================================================ FILE: lib/udp/lpi_bjnp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_bjnp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Could strengthen this by requiring 16 byte packets too if needed */ if (match_str_either(data, "BJNP")) return true; /* Apparently, there are a few other combinations that we can see */ if (match_str_either(data, "BNJB")) return true; if (match_str_either(data, "BJNB")) return true; if (match_str_either(data, "PJNB")) return true; if (match_str_either(data, "PNJB")) return true; return false; } static lpi_module_t lpi_bjnp = { LPI_PROTO_UDP_BJNP, LPI_CATEGORY_PRINTING, "Canon_BJNP", 3, match_bjnp }; void register_bjnp(LPIModuleMap *mod_map) { register_protocol(&lpi_bjnp, mod_map); } ================================================ FILE: lib/udp/lpi_bmdp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* BMDP is a protocol used by Microsoft Automated Deployment Services, a * system for remotely installing, configuring and maintained Windows Servers. * * Unfortunately, there is no obvious BMDP spec out there so this is just * based on what we have seen in our traffic. */ static inline bool match_bmdp_payload(uint32_t payload, uint32_t len) { uint32_t byte3 = ntohl(payload) & 0xff00; uint32_t byte4 = ntohl(payload) & 0x00ff; if (len == 0) return false; /* Byte 3 is always Xd, where X >=0 and X < 8 */ if ((ntohl(payload) & 0x7d00) != byte3) return false; /* There seem to be a fixed set of values for byte 4 and these seem * to also determine the length. * * So far I've limited this to byte4's that I've seen on multiple * occasions. */ if (byte4 == 0x2d && (len == 115 || len == 114)) return true; if (byte4 == 0x42 && len == 116) return true; if (byte4 == 0x5c && len == 117) return true; return false; } static inline bool match_bmdp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* XXX The typical port number is 8197, but usually you will see this * on a port ranging from 8190 to 8210. We could consider limiting * this rule to traffic matching those ports if we really wanted. */ /* Traffic is always one-way only */ if (data->payload_len[0] != 0 && data->payload_len[1] != 0) return false; if (match_bmdp_payload(data->payload[0], data->payload_len[0])) return true; if (match_bmdp_payload(data->payload[1], data->payload_len[1])) return true; return false; } static lpi_module_t lpi_bmdp = { LPI_PROTO_UDP_BMDP, LPI_CATEGORY_FILES, "BMDP", 70, match_bmdp }; void register_bmdp(LPIModuleMap *mod_map) { register_protocol(&lpi_bmdp, mod_map); } ================================================ FILE: lib/udp/lpi_btsync.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_btsync_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "BSYN")) return true; return false; } static lpi_module_t lpi_btsync_udp = { LPI_PROTO_UDP_BTSYNC, LPI_CATEGORY_FILES, "BitTorrentSync_UDP", 8, match_btsync_udp }; void register_btsync_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_btsync_udp, mod_map); } ================================================ FILE: lib/udp/lpi_cacaoweb_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_cacao_smalla(uint32_t payload, uint32_t len) { if (len > 15) return false; if ((ntohl(payload) & 0xa0000000) == 0xa0000000) return true; return false; } static inline bool match_cacao_other(uint32_t payload, uint32_t opp) { uint32_t firsta = ntohl(payload) >> 24; uint32_t lastb = ntohl(opp) & 0xff; if (firsta == lastb && firsta != 0) return true; return false; } static inline bool match_cacao_c0_12(uint32_t payload, uint32_t len) { if (len == 12 && MATCH(payload, 0xc0, ANY, ANY, ANY)) return true; return false; } static inline bool match_cacao_c0_14(uint32_t payload, uint32_t len) { if (len == 14 && MATCH(payload, 0xc0, ANY, ANY, ANY)) return true; return false; } static inline bool match_cacaoweb_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_cacao_smalla(data->payload[0], data->payload_len[0])) { if (match_cacao_other(data->payload[1], data->payload[0])) { return true; } } if (match_cacao_smalla(data->payload[1], data->payload_len[1])) { if (match_cacao_other(data->payload[0], data->payload[1])) { return true; } } if (match_cacao_c0_12(data->payload[0], data->payload_len[0])) { if (match_cacao_c0_14(data->payload[1], data->payload_len[1])) return true; } if (match_cacao_c0_12(data->payload[1], data->payload_len[1])) { if (match_cacao_c0_14(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_cacaoweb_udp = { LPI_PROTO_UDP_CACAOWEB, LPI_CATEGORY_P2P, "CacaowebUDP", 231, match_cacaoweb_udp }; void register_cacaoweb_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_cacaoweb_udp, mod_map); } ================================================ FILE: lib/udp/lpi_canon_mfnp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_canon_mfnp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 8610 && data->client_port != 8610) return false; if (match_str_either(data, "MFNP")) return true; return false; } static lpi_module_t lpi_canon_mfnp = { LPI_PROTO_UDP_MFNP, LPI_CATEGORY_PRINTING, "Canon_MFNP", 8, match_canon_mfnp }; void register_canon_mfnp(LPIModuleMap *mod_map) { register_protocol(&lpi_canon_mfnp, mod_map); } ================================================ FILE: lib/udp/lpi_chargen_exploit.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_chargen_exploit(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 19 && data->client_port != 19) return false; /* Matching chargen replies to spoofed sources */ if (data->payload_len[0] == 0 && MATCH(data->payload[1], 0x20, 0x21, 0x22, 0x23)) return true; if (data->payload_len[1] == 0 && MATCH(data->payload[0], 0x20, 0x21, 0x22, 0x23)) return true; return false; } static lpi_module_t lpi_chargen_exploit = { LPI_PROTO_UDP_CHARGEN_EXPLOIT, LPI_CATEGORY_MALWARE, "ChargenExploit", 200, match_chargen_exploit }; void register_chargen_exploit(LPIModuleMap *mod_map) { register_protocol(&lpi_chargen_exploit, mod_map); } ================================================ FILE: lib/udp/lpi_checkpoint_rdp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_checkpoint_rdp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* We only see this on port 259, so I'm pretty sure that this is * the Checkpoint proprietary RDP protocol (not to be confused with * Remote Desktop Protocol or the RDP transport protocol). * * Begins with a four byte magic number */ if (match_str_both(data, "\xf0\x01\xcc\xcc", "\xf0\x01\xcc\xcc")) return true; if (match_str_either(data, "\xf0\x01\xcc\xcc")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } return false; } static lpi_module_t lpi_checkpoint_rdp = { LPI_PROTO_UDP_CP_RDP, LPI_CATEGORY_KEY_EXCHANGE, "Checkpoint_RDP", 3, match_checkpoint_rdp }; void register_checkpoint_rdp(LPIModuleMap *mod_map) { register_protocol(&lpi_checkpoint_rdp, mod_map); } ================================================ FILE: lib/udp/lpi_chivalry.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Chivalry: Medieval Warfare -- a game */ static inline bool match_chivalry(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (MATCH(data->payload[0], 0x00, 0x00, 0x00, 0x00) && MATCH(data->payload[1], 0x00, 0x00, 0x00, 0x00)) { if (data->payload_len[0] == 12 && data->payload_len[1] == 15) return true; if (data->payload_len[1] == 12 && data->payload_len[0] == 15) return true; } return false; } static lpi_module_t lpi_chivalry = { LPI_PROTO_UDP_CHIVALRY, LPI_CATEGORY_GAMING, "Chivalry", 200, match_chivalry }; void register_chivalry(LPIModuleMap *mod_map) { register_protocol(&lpi_chivalry, mod_map); } ================================================ FILE: lib/udp/lpi_cip_io.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * 239.192.27.192 10.1.1.215 2222 2222 17 1599194119.713 1599194136.242 0 527360 00000000 .... 0 02000280 .... 80 * 10.1.1.215 10.1.1.200 2222 2222 17 1599194119.716 1599194136.397 187488 0 02000280 .... 56 00000000 .... 0 */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_cip(lpi_data_t *data) { if (MATCH(data->payload[0], 0x02, 0x00, 0x02, 0x80) && MATCH(data->payload[1], 0x00, 0x00, 0x00, 0x00)) return true; if (MATCH(data->payload[1], 0x02, 0x00, 0x02, 0x80) && MATCH(data->payload[0], 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_cip_io(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 2222 || data->client_port != 2222) return false; if (match_cip(data)) return true; return false; } static lpi_module_t lpi_cip_io = { LPI_PROTO_UDP_CIP_IO, LPI_CATEGORY_ICS, "CIP_I/O", 100, match_cip_io }; void register_cip_io(LPIModuleMap *mod_map) { register_protocol(&lpi_cip_io, mod_map); } ================================================ FILE: lib/udp/lpi_cirn.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_cirn_probe(uint32_t payload, uint32_t len) { if (MATCH(payload, 'P', 'a', 't', 'h') && len == 10) return true; return false; } static inline bool match_cirn_response(uint32_t payload, uint32_t len) { if (len == 0) return true; return false; } static inline bool match_cirn(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_cirn_probe(data->payload[0], data->payload_len[0])) { if (match_cirn_response(data->payload[1], data->payload_len[1])) return true; } if (match_cirn_probe(data->payload[1], data->payload_len[1])) { if (match_cirn_response(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_cirn = { LPI_PROTO_UDP_CIRN, LPI_CATEGORY_MONITORING, "CIRN_Probe", 8, match_cirn }; void register_cirn(LPIModuleMap *mod_map) { register_protocol(&lpi_cirn, mod_map); } ================================================ FILE: lib/udp/lpi_cisco_ipsec.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_cisco_ipsec_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len == 109) return true; if (len == 93) return true; return false; } static inline bool match_cisco_ipsec(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Been seeing this on UDP port 10000, which I assume is the * Cisco IPSec VPN */ if (data->server_port != 10000 && data->client_port != 10000) return false; if (!match_cisco_ipsec_payload(data->payload[0], data->payload_len[0])) return false; if (!match_cisco_ipsec_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_cisco_ipsec = { LPI_PROTO_UDP_CISCO_VPN, LPI_CATEGORY_TUNNELLING, "Cisco_VPN_UDP", 8, match_cisco_ipsec }; void register_cisco_ipsec(LPIModuleMap *mod_map) { register_protocol(&lpi_cisco_ipsec, mod_map); } ================================================ FILE: lib/udp/lpi_cisco_sslvpn.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_sslvpn(uint32_t payload) { /* Payload looks like SSL, except they've set the version field * to 1.0 (which would be invalid in real SSL) -- oh, Cisco! */ if (MATCH(payload, 0x16, 0x01, 0x00, 0x00)) return true; return false; } static inline bool match_cisco_sslvpn(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_sslvpn(data->payload[0]) && match_sslvpn(data->payload[1])) return true; return false; } static lpi_module_t lpi_cisco_sslvpn = { LPI_PROTO_UDP_CISCO_SSLVPN, LPI_CATEGORY_TUNNELLING, "CiscoSSLVPN", 5, match_cisco_sslvpn }; void register_cisco_sslvpn(LPIModuleMap *mod_map) { register_protocol(&lpi_cisco_sslvpn, mod_map); } ================================================ FILE: lib/udp/lpi_classin_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_classin_41(uint32_t payload, uint32_t len) { if (len == 41 && MATCH(payload, 0x1a, 0x03, 0x00, 0x02)) { return true; } return false; } static inline bool match_classin_56(uint32_t payload, uint32_t len) { if (len == 56 && MATCH(payload, 0x1a, 0x03, 0x00, 0x02)) { return true; } return false; } static inline bool match_classin_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_classin_41(data->payload[0], data->payload_len[0])) { if (match_classin_56(data->payload[1], data->payload_len[1])) { return true; } } if (match_classin_41(data->payload[1], data->payload_len[1])) { if (match_classin_56(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_classin_udp = { LPI_PROTO_UDP_CLASSIN, LPI_CATEGORY_EDUCATIONAL, "ClassIn_UDP", 133, match_classin_udp }; void register_classin_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_classin_udp, mod_map); } ================================================ FILE: lib/udp/lpi_cloudflare_warp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* 01 == handshake begin */ static inline bool match_warp_01(uint32_t payload, uint32_t len) { if (len != 148) { return false; } if (MATCH(payload, 0x01, ANY, ANY, ANY)) { if (MATCH(payload, 0x01, 0x00, 0x00, 0x00)) { return false; } return true; } return false; } /* 02 == handshake reply */ static inline bool match_warp_02(uint32_t payload, uint32_t len) { if (len != 92) { return false; } if (MATCH(payload, 0x02, ANY, ANY, ANY)) { return true; } return false; } /* 04 == data (for sessions where we missed part of the handshake */ static inline bool match_warp_04(uint32_t payload, uint32_t len) { /* 100 is approximate, but 1312 seems to be an actual * Max Datagram Size */ if (len < 100 || len > 1312) { return false; } if (MATCH(payload, 0x04, ANY, ANY, ANY)) { return true; } return false; } static inline bool is_cf_warp_port(lpi_data_t *data) { if (data->server_port == 2408 || data->client_port == 2408) { return true; } if (data->server_port == 1701 || data->client_port == 1701) { return true; } if (data->server_port == 500 || data->client_port == 500) { return true; } return false; } static inline bool match_cloudflare_warp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!is_cf_warp_port(data)) { return false; } if (match_warp_01(data->payload[0], data->payload_len[0])) { if (match_warp_02(data->payload[1], data->payload_len[1])) { return true; } if (match_warp_04(data->payload[1], data->payload_len[1])) { return true; } } if (match_warp_01(data->payload[1], data->payload_len[1])) { if (match_warp_02(data->payload[0], data->payload_len[0])) { return true; } if (match_warp_04(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_cloudflare_warp = { LPI_PROTO_UDP_CLOUDFLARE_WARP, LPI_CATEGORY_TUNNELLING, "CloudflareWarp", 21, match_cloudflare_warp }; void register_cloudflare_warp(LPIModuleMap *mod_map) { register_protocol(&lpi_cloudflare_warp, mod_map); } ================================================ FILE: lib/udp/lpi_cod.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_cod_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (!MATCH(payload, 0xff, 0xff, 0xff, 0xff)) return false; return true; } static inline bool match_callofduty(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_cod_payload(data->payload[0], data->payload_len[0])) return false; if (!match_cod_payload(data->payload[1], data->payload_len[1])) return false; /* One packet is always 14 or 15 bytes, the other is usually much * larger */ if (data->payload_len[0] == 14 || data->payload_len[0] == 15) { if (data->payload_len[1] == 0) return true; if (data->payload_len[1] > 100) return true; } if (data->payload_len[1] == 14 || data->payload_len[1] == 15) { if (data->payload_len[0] == 0) return true; if (data->payload_len[0] > 100) return true; } /* 13 is also observed */ if (data->payload_len[0] == 13) { if (data->payload_len[1] > 880) return true; if (data->payload_len[1] >= 225 && data->payload_len[1] <= 250) return true; } /* Other packet size combos */ /* 74 seems to be common on port 20800 which is associated with * COD:WaW */ if (data->payload_len[0] == 74) { if (data->payload_len[1] == 0) return true; } if (data->payload_len[1] == 74) { if (data->payload_len[0] == 0) return true; } if (data->payload_len[0] == 45) { if (data->payload_len[1] == 0) return true; } if (data->payload_len[1] == 45) { if (data->payload_len[0] == 0) return true; } if (data->payload_len[0] == 53) { if (data->payload_len[1] < 30) return false; if (data->payload_len[1] > 33) return false; return true; } if (data->payload_len[1] == 53) { if (data->payload_len[0] < 30) return false; if (data->payload_len[0] > 33) return false; return true; } if (data->payload_len[0] == 16) { if (data->payload_len[1] == 18) return true; if (data->payload_len[1] == 16) return true; if (data->payload_len[1] == 13) return true; if (data->payload_len[1] == 0) { return true; } } if (data->payload_len[1] == 16) { if (data->payload_len[0] == 18) return true; if (data->payload_len[0] == 16) return true; if (data->payload_len[0] == 13) return true; if (data->payload_len[0] == 0) { return true; } } if (data->payload_len[0] >= 16 && data->payload_len[0] <= 19) { if (data->payload_len[1] < 40) return false; if (data->payload_len[1] > 44) return false; return true; } if (data->payload_len[1] >= 16 && data->payload_len[1] <= 19) { if (data->payload_len[0] < 40) return false; if (data->payload_len[0] > 44) return false; return true; } return false; } static lpi_module_t lpi_callofduty = { LPI_PROTO_UDP_COD, LPI_CATEGORY_GAMING, "Call_of_Duty", 60, /* Must be lower priority than XLSP */ match_callofduty }; void register_callofduty(LPIModuleMap *mod_map) { register_protocol(&lpi_callofduty, mod_map); } ================================================ FILE: lib/udp/lpi_codmobile.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_cod_mob84(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x43, 0x01, 0xc0, 0x12) && len == 84) { return true; } return false; } static inline bool match_cod_mob12(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x43, 0x02, 0xc0, 0x00) && len == 12) { return true; } return false; } static inline bool match_codmobile(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_cod_mob84(data->payload[0], data->payload_len[0])) { if (match_cod_mob12(data->payload[1], data->payload_len[1])) { return true; } } if (match_cod_mob84(data->payload[1], data->payload_len[1])) { if (match_cod_mob12(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_codmobile = { LPI_PROTO_UDP_COD_MOBILE, LPI_CATEGORY_GAMING, "CallOfDuty_Mobile", 15, match_codmobile }; void register_codmobile(LPIModuleMap *mod_map) { register_protocol(&lpi_codmobile, mod_map); } ================================================ FILE: lib/udp/lpi_combatarms.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_arms_5(uint32_t payload, uint32_t len) { if (len == 5 && MATCH(payload, 0x00, 0xf1, 0x37, 0x13)) return true; return false; } static inline bool match_arms_any(uint32_t payload, uint32_t len) { if (len < 100 && MATCH(payload, 0x00, 0xf1, 0x37, 0x13)) return true; return false; } static inline bool match_combatarms(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_arms_5(data->payload[0],data->payload_len[0])) { if (match_arms_any(data->payload[1], data->payload_len[1])) return true; } if (match_arms_5(data->payload[1],data->payload_len[1])) { if (match_arms_any(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_combatarms = { LPI_PROTO_UDP_COMBATARMS, LPI_CATEGORY_GAMING, "CombatArms", 40, match_combatarms }; void register_combatarms(LPIModuleMap *mod_map) { register_protocol(&lpi_combatarms, mod_map); } ================================================ FILE: lib/udp/lpi_combatarms_p2p.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_arms_p2p_ping(uint32_t payload, uint32_t len) { if (len == 28 && MATCH(payload, 0x00, 0x00, 0xc0, 0x00)) return true; if (len == 28 && MATCH(payload, 0x00, 0x00, 0xc0, 0x01)) return true; return false; } static inline bool match_arms_p2p_pong(uint32_t payload, uint32_t len) { if (len == 28 && MATCH(payload, 0x00, 0x00, 0xc0, 0x00)) return true; if (len == 28 && MATCH(payload, 0x00, 0x00, 0xc0, 0x01)) return true; if (len == 0) return true; return false; } static inline bool match_combatarms_p2p(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Another protocol, probably used for direct player to * player communication. */ if (match_arms_p2p_ping(data->payload[0], data->payload_len[0])) { if (match_arms_p2p_pong(data->payload[1], data->payload_len[1])) return true; } if (match_arms_p2p_ping(data->payload[1], data->payload_len[1])) { if (match_arms_p2p_pong(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_combatarms_p2p = { LPI_PROTO_UDP_COMBATARMS_P2P, LPI_CATEGORY_GAMING, "CombatArms_P2P", 140, match_combatarms_p2p }; void register_combatarms_p2p(LPIModuleMap *mod_map) { register_protocol(&lpi_combatarms_p2p, mod_map); } ================================================ FILE: lib/udp/lpi_contract_wars.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_cw_09(uint32_t payload, uint32_t len) { if (len < 1300) { return false; } if (MATCH(payload, 0x09, 0x0b, 0x0d, 0xd0)) { return true; } if (MATCH(payload, 0x09, 0x0b, 0x00, 0x80)) { return true; } return false; } static inline bool match_cw_0a(uint32_t payload, uint32_t len) { if (len < 1300) { return false; } if (MATCHSTR(payload, "\x0a\x00\xff\xff")) { return true; } return false; } static inline bool match_contract_wars(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_cw_09(data->payload[0], data->payload_len[0])) { if (match_cw_0a(data->payload[1], data->payload_len[1])) { return true; } } if (match_cw_09(data->payload[1], data->payload_len[1])) { if (match_cw_0a(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_contract_wars = { LPI_PROTO_UDP_CONTRACT_WARS, LPI_CATEGORY_GAMING, "ContractWars", 50, match_contract_wars }; void register_contract_wars(LPIModuleMap *mod_map) { register_protocol(&lpi_contract_wars, mod_map); } ================================================ FILE: lib/udp/lpi_crossfire.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_cf_25(uint32_t payload, uint32_t len) { if (len == 25 && MATCH(payload, 0xc7, 0xd9, 0x19, 0x99)) return true; if (len == 35 && MATCH(payload, 0xc7, 0xd9, 0x19, 0x99)) return true; return false; } static inline bool match_cf_5(uint32_t payload, uint32_t len) { if (len == 5 && MATCH(payload, 0xc7, 0xd9, 0x19, 0x99)) return true; return false; } static inline bool match_crossfire(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_cf_25(data->payload[0], data->payload_len[0])) { if (match_cf_5(data->payload[1], data->payload_len[1])) return true; } if (match_cf_25(data->payload[1], data->payload_len[1])) { if (match_cf_5(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_crossfire = { LPI_PROTO_UDP_CROSSFIRE, LPI_CATEGORY_GAMING, "CrossfireUDP", 10, match_crossfire }; void register_crossfire(LPIModuleMap *mod_map) { register_protocol(&lpi_crossfire, mod_map); } ================================================ FILE: lib/udp/lpi_crossout.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_co_05(uint32_t payload, uint32_t len) { if (len == 1322 && MATCHSTR(payload, "\x05\x00\xff\xff")) return true; return false; } static inline bool match_co_06(uint32_t payload, uint32_t len) { if (len == 1322 && MATCHSTR(payload, "\x06\x00\xff\xff")) return true; return false; } static inline bool match_crossout(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_co_05(data->payload[0], data->payload_len[0])) { if (match_co_06(data->payload[1], data->payload_len[1])) return true; } if (match_co_05(data->payload[1], data->payload_len[1])) { if (match_co_06(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_crossout = { LPI_PROTO_UDP_CROSSOUT, LPI_CATEGORY_GAMING, "Crossout", 11, match_crossout }; void register_crossout(LPIModuleMap *mod_map) { register_protocol(&lpi_crossout, mod_map); } ================================================ FILE: lib/udp/lpi_csgo.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Pretty sure this is Counterstrike: Global Offensive (saw references to the * map 'mg_de_dust' in other flows between the same endpoints). */ static inline bool match_ff_csgo(lpi_data_t *data) { if (!match_str_both(data, "\xff\xff\xff\xff", "\xff\xff\xff\xff")) return false; if (data->payload_len[0] == 33 && data->payload_len[1] == 18) return true; if (data->payload_len[1] == 33 && data->payload_len[0] == 18) return true; if (data->payload_len[0] == 23 && data->payload_len[1] >= 61 && data->payload_len[1] <= 66) return true; if (data->payload_len[1] == 23 && data->payload_len[0] >= 61 && data->payload_len[0] <= 66) return true; return false; } static inline bool match_sdping(uint32_t payload) { if (MATCH(payload, 0x01, 0x00, 's', 'd')) return true; return false; } static inline bool match_sdpong(uint32_t payload) { if (MATCH(payload, 0x02, 0x12, 'T', 'l')) return true; if (MATCH(payload, 0x02, 0x12, 'T', 'd')) return true; if (MATCH(payload, 0x02, 0x12, 'X', 'd')) return true; return false; } static inline bool match_csgo(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_ff_csgo(data)) { return true; } if (match_sdping(data->payload[0])) { if (match_sdpong(data->payload[1])) return true; } if (match_sdping(data->payload[1])) { if (match_sdpong(data->payload[0])) return true; } return false; } static lpi_module_t lpi_csgo = { LPI_PROTO_UDP_CS_GLOBAL_OFFENSIVE, LPI_CATEGORY_GAMING, "CSGlobalOffensive", 18, match_csgo }; void register_csgo(LPIModuleMap *mod_map) { register_protocol(&lpi_csgo, mod_map); } ================================================ FILE: lib/udp/lpi_csoriginal.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_csorig_14(uint32_t payload, uint32_t len) { if (len == 14 && MATCHSTR(payload, "\xff\xff\xff\xff")) return true; return false; } static inline bool match_csorig_big(uint32_t payload, uint32_t len) { if (len >= 800 && len < 1000 && MATCHSTR(payload, "\xff\xff\xff\xff")) return true; return false; } static inline bool match_csoriginal(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_csorig_14(data->payload[0], data->payload_len[0])) { if (match_csorig_big(data->payload[1], data->payload_len[1])) return true; } if (match_csorig_14(data->payload[1], data->payload_len[1])) { if (match_csorig_big(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_csoriginal = { LPI_PROTO_UDP_COUNTERSTRIKE_16, LPI_CATEGORY_GAMING, "Counterstrike1.6", 50, match_csoriginal }; void register_csoriginal(LPIModuleMap *mod_map) { register_protocol(&lpi_csoriginal, mod_map); } ================================================ FILE: lib/udp/lpi_dahua.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Chinese IP surveillance Cameras */ static inline bool match_dahua_p2p(uint32_t payload, uint32_t len) { if (len == 44 && MATCHSTR(payload, "\xff\xfe\xff\xe7")) return true; return false; } static inline bool match_dahua(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_dahua_p2p(data->payload[0], data->payload_len[0])) { if (match_dahua_p2p(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_dahua = { LPI_PROTO_UDP_DAHUA, LPI_CATEGORY_IPCAMERAS, "Dahua", 13, match_dahua }; void register_dahua(LPIModuleMap *mod_map) { register_protocol(&lpi_dahua, mod_map); } ================================================ FILE: lib/udp/lpi_db2.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_db2_query(uint32_t payload, uint32_t len) { if (len != 20) return false; if (!MATCHSTR(payload, "DB2G")) return false; return true; } static inline bool match_db2_response(uint32_t payload, uint32_t len) { if (len == 0) return true; return false; } static inline bool match_db2(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Only ever seen this as scan traffic so far, so no idea what the * response should look like. */ /* Assume port 523 for now */ if (data->server_port != 523 && data->client_port != 523) return false; if (match_db2_query(data->payload[0], data->payload_len[0])) { if (match_db2_response(data->payload[1], data->payload_len[1])) return true; } if (match_db2_query(data->payload[1], data->payload_len[1])) { if (match_db2_response(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_db2 = { LPI_PROTO_UDP_DB2, LPI_CATEGORY_DATABASES, "IBM-DB2", 6, match_db2 }; void register_db2(LPIModuleMap *mod_map) { register_protocol(&lpi_db2, mod_map); } ================================================ FILE: lib/udp/lpi_dcc.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* DCC is the IRC-based file sharing protocol, not to be confused with * Direct Connect */ static inline bool match_dcc_length(uint32_t payload, uint32_t len) { uint32_t hdr_len; hdr_len = (ntohl(payload)) >> 16; if (hdr_len == len) return true; return false; } static inline bool match_dcc_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_dcc_length(data->payload[0], data->payload_len[0])) return false; if (!match_dcc_length(data->payload[1], data->payload_len[1])) return false; /* Byte 3 must match */ if ((ntohl(data->payload[0]) & 0xff00) != (ntohl(data->payload[1]) & 0xff00)) return false; if (MATCH(data->payload[0], ANY, ANY, ANY, 0x01)) { if (MATCH(data->payload[1], ANY, ANY, ANY, 0x06)) return true; } if (MATCH(data->payload[1], ANY, ANY, ANY, 0x01)) { if (MATCH(data->payload[0], ANY, ANY, ANY, 0x06)) return true; } if (MATCH(data->payload[0], ANY, ANY, ANY, 0x02)) { if (MATCH(data->payload[1], ANY, ANY, ANY, 0x04)) return true; } if (MATCH(data->payload[1], ANY, ANY, ANY, 0x02)) { if (MATCH(data->payload[0], ANY, ANY, ANY, 0x04)) return true; } return false; } static lpi_module_t lpi_dcc_udp = { LPI_PROTO_UDP_DCC, LPI_CATEGORY_CHAT, "DCC_UDP", 8, match_dcc_udp }; void register_dcc_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_dcc_udp, mod_map); } ================================================ FILE: lib/udp/lpi_demonware.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_demonware(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This is some sort of control channel for demonware? */ if (data->payload_len[0] == 15 && data->payload_len[1] == 0) { if (MATCH(data->payload[0], 0x15, 0x02, 0x00, ANY)) return true; } if (data->payload_len[1] == 15 && data->payload_len[0] == 0) { if (MATCH(data->payload[1], 0x15, 0x02, 0x00, ANY)) return true; } /* Demonware bandwidth testing involves sending a series of 1024 * byte packets to a known server - each packet has an incrementing * seqno, starting from zero */ if (!match_str_both(data, "\x00\x00\x00\x00", "\x00\x00\x00\x00")) return false; if (data->payload_len[0] == 1024) { if (data->payload_len[1] == 0) return true; if (data->payload_len[1] == 1024) return true; } if (data->payload_len[1] == 1024) { if (data->payload_len[0] == 0) return true; } /* Sometimes 512 bytes are used as well, but only ever one-way */ if (data->payload_len[0] == 512) { if (data->payload_len[1] == 0) return true; } if (data->payload_len[1] == 512) { if (data->payload_len[0] == 0) return true; } /* Could also check for ports 3074 and 3075 if needed */ return false; } static lpi_module_t lpi_demonware = { LPI_PROTO_UDP_DEMONWARE, LPI_CATEGORY_GAMING, "Demonware", 4, match_demonware }; void register_demonware(LPIModuleMap *mod_map) { register_protocol(&lpi_demonware, mod_map); } ================================================ FILE: lib/udp/lpi_destiny_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_destiny_299(uint32_t payload, uint32_t len) { if (len == 299 && MATCH(payload, 0x00, 0x00, 0x00, 0x01)) return true; return false; } static inline bool match_destiny_423(uint32_t payload, uint32_t len) { if (len == 423 && MATCH(payload, 0x00, 0x00, 0x00, 0x01)) return true; return false; } static inline bool match_destiny_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 3074 && data->client_port != 3074) return false; if (match_destiny_299(data->payload[0], data->payload_len[0])) { if (match_destiny_423(data->payload[1], data->payload_len[1])) return true; } if (match_destiny_299(data->payload[1], data->payload_len[1])) { if (match_destiny_423(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_destiny_udp = { LPI_PROTO_UDP_DESTINY, LPI_CATEGORY_GAMING, "DestinyUDP", 166, match_destiny_udp }; void register_destiny_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_destiny_udp, mod_map); } ================================================ FILE: lib/udp/lpi_dhcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_dhcp_v4(lpi_data_t *data) { if (match_chars_either(data, 0x01, 0x01, 0x06, 0x00)) return true; if (match_chars_either(data, 0x02, 0x01, 0x06, 0x00)) return true; return false; } static inline bool match_dhcp_v6_ports(uint16_t porta, uint16_t portb) { if (porta == 547 && portb == 546) return true; if (portb == 547 && porta == 546) return true; return false; } static inline bool match_dhcp_v6_solicit(uint32_t payload, uint32_t len) { if (len < 52) return false; if (!MATCH(payload, 0x01, ANY, ANY, ANY)) return false; return true; } static inline bool match_dhcp_v6_advert(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 0x02, ANY, ANY, ANY)) return false; return true; } static inline bool match_dhcp_v6(lpi_data_t *data) { if (!match_dhcp_v6_ports(data->server_port, data->client_port)) return false; if (match_dhcp_v6_solicit(data->payload[0], data->payload_len[0])) { if (match_dhcp_v6_advert(data->payload[1], data->payload_len[1])) { return true; } } if (match_dhcp_v6_solicit(data->payload[1], data->payload_len[1])) { if (match_dhcp_v6_advert(data->payload[0], data->payload_len[0])) { return true; } } return false; } static inline bool match_dhcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_dhcp_v4(data)) return true; if (match_dhcp_v6(data)) return true; return false; } static lpi_module_t lpi_dhcp = { LPI_PROTO_UDP_DHCP, LPI_CATEGORY_SERVICES, "DHCP", 8, match_dhcp }; void register_dhcp(LPIModuleMap *mod_map) { register_protocol(&lpi_dhcp, mod_map); } ================================================ FILE: lib/udp/lpi_dht_dict.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Separate modules for dictionary-style DHT (which has a much stronger rule) * and Vuze DHTs (which are not so strong) * * This source file also covers the uTP protocol, which typically shares the * same flow as the dictionary DHTs */ static inline bool match_utp_query(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x01, 0x00, ANY, ANY)) return true; if (MATCH(payload, 0x11, 0x00, ANY, ANY) && len == 20) return true; if (MATCH(payload, 0x21, 0x02, ANY, ANY) && len == 30) return true; if (MATCH(payload, 0x21, 0x00, ANY, ANY) && len == 20) return true; if (MATCH(payload, 0x31, 0x02, ANY, ANY) && len == 30) return true; if (MATCH(payload, 0x31, 0x00, ANY, ANY) && len == 20) return true; if (MATCH(payload, 0x41, 0x02, ANY, ANY) && len == 30) return true; if (MATCH(payload, 0x41, 0x00, ANY, ANY) && len == 20) return true; return false; } static inline bool match_utp_reply(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 0x11, 0x00, ANY, ANY) && len == 20) return true; if (MATCH(payload, 0x21, 0x02, ANY, ANY) && (len == 30 || len == 33)) return true; if (MATCH(payload, 0x21, 0x01, ANY, ANY) && (len == 26 || len == 23)) return true; if (MATCH(payload, 0x21, 0x00, ANY, ANY) && len == 20) return true; if (MATCH(payload, 0x31, 0x02, ANY, ANY) && len == 30) return true; if (MATCH(payload, 0x31, 0x00, ANY, ANY) && len == 20) return true; if (MATCH(payload, 0x41, 0x00, ANY, ANY) && len == 20) return true; if (MATCH(payload, 0x41, 0x02, ANY, ANY) && (len == 33 || len == 30)) return true; return false; } static inline bool match_opentracker_98(uint32_t payload, uint32_t len) { if (len == 98 || len == 109) return true; return false; } static inline bool match_opentracker_X6(uint32_t payload, uint32_t len) { if (len >= 36 && (len % 10) == 6) return true; return false; } static inline bool match_opentracker_01(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x00, 0x00, 0x00, 0x01)) return true; return false; } static inline bool match_opentracker_02(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x00, 0x00, 0x00, 0x02)) return true; return false; } static inline bool match_dict_query(uint32_t payload, uint32_t len) { if (MATCH(payload, 'd', '1', ':', 'a')) return true; if (MATCH(payload, 'd', '1', ':', 'r')) return true; if (MATCH(payload, 'd', '1', ':', 'e')) return true; if (MATCH(payload, 'd', '1', ':', 'q')) return true; if (MATCH(payload, 'd', '1', ':', 't')) return true; if (MATCH(payload, 'd', '1', ANY, ':')) return true; return false; } static inline bool match_dict_reply(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 'd', '1', ':', 'a')) return true; if (MATCH(payload, 'd', '1', ':', 'r')) return true; if (MATCH(payload, 'd', '1', ':', 'e')) return true; if (MATCH(payload, 'd', '1', ANY, ':')) return true; if (MATCH(payload, 'd', '2', ':', 'i')) return true; /* These are a bit iffy, but this seems to be what happens in * response to a lot of dict queries :/ */ if (len == 23) return true; if (len == 33) return true; return false; } static inline bool num_seq_match(uint32_t query, uint32_t resp) { uint32_t query_seq = (ntohl(query)) & 0x0000ffff; uint32_t resp_seq = (ntohl(resp)) & 0x0000ffff; if (query_seq == resp_seq) return true; /* Allowed to be seq +/- 1 as well, apparently */ if (query_seq == resp_seq + 1) return true; if (query_seq == resp_seq - 1) return true; return false; } static inline bool match_bt_search(uint32_t payload, uint32_t len) { /* Matches the BT-SEARCH command, which we've seen while messing with * World of Warcraft */ if (MATCHSTR(payload, "BT-S")) return true; return false; } static inline bool match_dht_dict(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_dict_query(data->payload[0], data->payload_len[0])) { if (match_dict_reply(data->payload[1], data->payload_len[1])) return true; if (match_utp_reply(data->payload[1], data->payload_len[1])) return true; if (match_utp_query(data->payload[1], data->payload_len[1])) return true; } if (match_dict_query(data->payload[1], data->payload_len[1])) { if (match_dict_reply(data->payload[0], data->payload_len[0])) return true; if (match_utp_reply(data->payload[0], data->payload_len[0])) return true; if (match_utp_query(data->payload[0], data->payload_len[0])) return true; } if (match_utp_query(data->payload[0], data->payload_len[0])) { if (MATCH(data->payload[0], 0x01, 0x00, ANY, ANY)) { if (!num_seq_match(data->payload[0], data->payload[1])) return false; } if (match_utp_reply(data->payload[1], data->payload_len[1])) return true; if (match_dict_reply(data->payload[1], data->payload_len[1])) return true; } if (match_utp_query(data->payload[1], data->payload_len[1])) { if (MATCH(data->payload[1], 0x01, 0x00, ANY, ANY)) { if (!num_seq_match(data->payload[1], data->payload[0])) return false; } if (match_utp_reply(data->payload[0], data->payload_len[0])) return true; if (match_dict_reply(data->payload[0], data->payload_len[0])) return true; } if (match_bt_search(data->payload[0], data->payload_len[0])) { if (data->payload_len[1] == 0) return true; } if (match_bt_search(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] == 0) return true; } if (match_opentracker_X6(data->payload[0], data->payload_len[0])) { if (match_opentracker_02(data->payload[1], data->payload_len[1])) return true; } if (match_opentracker_X6(data->payload[1], data->payload_len[1])) { if (match_opentracker_02(data->payload[0], data->payload_len[0])) return true; } if (match_opentracker_98(data->payload[0], data->payload_len[0])) { if (match_opentracker_01(data->payload[1], data->payload_len[1])) return true; } if (match_opentracker_98(data->payload[1], data->payload_len[1])) { if (match_opentracker_01(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_dht_dict = { LPI_PROTO_UDP_BTDHT, LPI_CATEGORY_P2P, "BitTorrent_UDP", 6, match_dht_dict }; void register_dht_dict(LPIModuleMap *mod_map) { register_protocol(&lpi_dht_dict, mod_map); } ================================================ FILE: lib/udp/lpi_dht_other.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* http://xbtt.sourceforge.net/udp_tracker_protocol.html */ static inline bool match_xbt_tracker(lpi_data_t *data) { if (data->payload_len[0] != 0 && data->payload_len[0] != 16) return false; if (data->payload_len[1] != 0 && data->payload_len[1] != 16) return false; if (!match_chars_either(data, 0x00, 0x00, 0x04, 0x17)) return false; if (data->payload_len[0] == 0 || data->payload_len[1] == 0) return true; if (data->payload_len[0] == 16 && data->payload_len[1] == 16 && match_chars_either(data, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_unknown_btudp(lpi_data_t *data) { /* I have not been able to figure out exactly what this stuff * is, but I'm pretty confident it is somehow related to a * BitTorrent implementation or two */ /* The recipient does not reply */ if (data->payload_len[0] > 0 && data->payload_len[1] > 0) return false; if (!(match_str_both(data, "\x00\x00\x00\x00", "\x00\x00\x00\x00"))) return false; if (data->payload_len[0] == 14 || data->payload_len[0] == 18) return true; if (data->payload_len[1] == 14 || data->payload_len[1] == 18) return true; return false; } static inline bool match_vuze_dht_request(uint32_t payload, uint32_t len, bool check_msb) { /* Some implementations don't choose an appropriate MSB or get the * byte ordering wrong, so we only force an MSB check when we're * examining requests that get no response. */ if (len < 4) return false; if (check_msb) { if ((ntohl(payload) & 0x80000000) != 0x80000000) return false; } else { /* Automatically return true if the MSB is set, regardless of * request size */ if ((ntohl(payload) & 0x80000000) == 0x80000000) return true; } if (len == 42 || len == 51) { return true; } if (len == 63 || len == 65 || len == 71) return true; return false; } static inline bool match_vuze_dht_reply(uint32_t data, uint32_t len) { /* Each reply action is an odd number */ if (MATCH(data, 0x00, 0x00, 0x04, 0x01)) return true; if (MATCH(data, 0x00, 0x00, 0x04, 0x03)) return true; if (MATCH(data, 0x00, 0x00, 0x04, 0x05)) return true; if (MATCH(data, 0x00, 0x00, 0x04, 0x07)) return true; /* Except for this one, which is an error message */ if (MATCH(data, 0x00, 0x00, 0x04, 0x08)) return true; return false; } static inline bool match_vuze_dht_alt(lpi_data_t *data) { /* Flows matching this rule *appear* to be doing something related * to the Vuze DHT system, but this behaviour is undocumented. * * I have observed flows that match the conventional Vuze DHT rule * involving the same IP/port as flows that match this rule, so * that does suggest it is related to Vuze somehow. */ if (data->payload_len[0] != 0 && (ntohl(data->payload[0]) & 0x80000000) != 0x80000000) return false; if (data->payload_len[1] != 0 && (ntohl(data->payload[1]) & 0x80000000) != 0x80000000) return false; if (data->payload_len[0] == 90 && data->payload_len[1] == 79) return true; if (data->payload_len[1] == 90 && data->payload_len[0] == 79) return true; if (data->payload_len[0] == 90 && data->payload_len[1] == 0) return true; if (data->payload_len[1] == 90 && data->payload_len[0] == 0) return true; return false; } static inline bool match_vuze_dht(lpi_data_t *data) { /* OK, gotta rework this one as this protocol is a bit messed up in * the implementation. * * Normally, we have a request which contains a random number in * the first four bytes. However, the MSB of that number must be * set to one. * * The reply begins with a four byte action which is easy to identify. * * However, we also get replies in both directions (which is a bit * odd). I'm also seeing requests where the MSB is not set, which is * a definite violation. * * However, I think we want to count these - they are clearly attempts * to use this protocol so classing them as unknown doesn't seem * right. */ if (match_vuze_dht_reply(data->payload[0], data->payload_len[0])) { if (data->payload_len[1] == 0) return true; if (match_vuze_dht_request(data->payload[1], data->payload_len[1], false)) return true; /* Check for replies in both directions */ if (match_vuze_dht_reply(data->payload[1], data->payload_len[1])) return true; } if (match_vuze_dht_reply(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] == 0) return true; if (match_vuze_dht_request(data->payload[0], data->payload_len[0], false)) return true; /* Check for replies in both directions */ if (match_vuze_dht_reply(data->payload[0], data->payload_len[0])) return true; } /* Check for unanswered requests - these are much harder to match, * because they are simply a random conn id. We can only hope to match * on common packet sizes and the MSB being set * * XXX This could lead to a few false positives, so be careful */ if (data->payload[0] == 0) { if (match_vuze_dht_request(data->payload[1], data->payload_len[1], true)) return true; } if (data->payload[1] == 0) { if (match_vuze_dht_request(data->payload[0], data->payload_len[0], true)) return true; } /* Apparently, we can also see requests both ways, which is a bit * less than ideal.... */ if (match_vuze_dht_request(data->payload[0], data->payload_len[0], true) && match_vuze_dht_request(data->payload[1], data->payload_len[1], true)) return true; if (match_vuze_dht_alt(data)) return true; return false; } static inline bool match_unknown_dht(lpi_data_t *data) { /* I don't know exactly what BT clients do this, but there are often * DHT queries and responses present in flows that match this rule, * so we're going to go with some form of Bittorrent */ if (data->payload[0] == 0 || data->payload[1] == 0) return false; /* Both initial packets are 33 bytes and have the exact same * payload */ if (data->payload_len[0] != 33 || data->payload_len[1] != 33) return false; if (data->payload[0] != data->payload[1]) return false; return true; } static inline bool match_dht_other(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_unknown_btudp(data)) return true; if (match_vuze_dht(data)) return true; if (match_xbt_tracker(data)) return true; if (match_unknown_dht(data)) return true; return false; } static lpi_module_t lpi_dht_other = { LPI_PROTO_UDP_BTDHT, LPI_CATEGORY_P2P, "BitTorrent_UDP", 12, /* Need to be lower priority than DNS, at least in cases * where traffic is one-way only */ match_dht_other }; void register_dht_other(LPIModuleMap *mod_map) { register_protocol(&lpi_dht_other, mod_map); } ================================================ FILE: lib/udp/lpi_diablo2.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_diablo2_message(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 0x03, 0x00, 0x00, 0x00) && len == 8) return true; if (MATCH(payload, 0x05, 0x00, 0x00, 0x00) && len == 8) return true; if (MATCH(payload, 0x09, 0x00, 0x00, 0x00) && len == 12) return true; return false; } static inline bool match_diablo2(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 6112 && data->client_port != 6112) return false; if (!match_diablo2_message(data->payload[0], data->payload_len[0])) return false; if (!match_diablo2_message(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_diablo2 = { LPI_PROTO_UDP_DIABLO2, LPI_CATEGORY_GAMING, "Diablo2", 3, match_diablo2 }; void register_diablo2(LPIModuleMap *mod_map) { register_protocol(&lpi_diablo2, mod_map); } ================================================ FILE: lib/udp/lpi_dianping_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_dianping_query(uint32_t payload, uint32_t len) { if (len != 14) return false; if (MATCH(payload, 0x4e, 0x58, 0x00, 0x0a)) return true; return false; } static inline bool match_dianping_resp(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len != 16) return false; if (MATCH(payload, 0x4e, 0x58, 0x00, 0x0c)) return true; return false; } static inline bool match_dianping_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_dianping_query(data->payload[0], data->payload_len[0])) { if (match_dianping_resp(data->payload[1], data->payload_len[1])) return true; } if (match_dianping_query(data->payload[1], data->payload_len[1])) { if (match_dianping_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_dianping_udp = { LPI_PROTO_UDP_DIANPING, LPI_CATEGORY_MOBILE_APP, "DianpingUDP", 21, match_dianping_udp }; void register_dianping_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_dianping_udp, mod_map); } ================================================ FILE: lib/udp/lpi_dianshijia.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* APK name = com.dianshijia.tvlive */ /* Published by New Zealand ibestv Trading Limited (?) */ static inline bool match_dsj_req(uint32_t payload, uint32_t len) { if (len == 20 && MATCHSTR(payload, "\xff\x03\x00\x00")) return true; return false; } static inline bool match_dsj_reply(uint32_t payload, uint32_t len) { if (len == 20 && MATCHSTR(payload, "\xff\x05\x00\x00")) return true; if (len == 20 && MATCHSTR(payload, "\xff\x03\x01\x00")) return true; return false; } static inline bool match_dianshijia(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_dsj_req(data->payload[0], data->payload_len[0])) { if (match_dsj_reply(data->payload[1], data->payload_len[1])) return true; } if (match_dsj_req(data->payload[1], data->payload_len[1])) { if (match_dsj_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_dianshijia = { LPI_PROTO_UDP_DIANSHIJIA, LPI_CATEGORY_P2PTV, /* I think... */ "Dianshijia", 100, match_dianshijia }; void register_dianshijia(LPIModuleMap *mod_map) { register_protocol(&lpi_dianshijia, mod_map); } ================================================ FILE: lib/udp/lpi_directconnect.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_directconnect_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->payload_len[0] == 0 && MATCHSTR(data->payload[1], "$SR ")) return true; if (data->payload_len[1] == 0 && MATCHSTR(data->payload[0], "$SR ")) return true; return false; } static lpi_module_t lpi_directconnect_udp = { LPI_PROTO_UDP_DC, LPI_CATEGORY_P2P, "DirectConnect_UDP", 3, match_directconnect_udp }; void register_directconnect_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_directconnect_udp, mod_map); } ================================================ FILE: lib/udp/lpi_discord.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* discord.gg */ static inline bool discord_payload_match(uint32_t a, uint32_t b) { uint32_t bytea = (ntohl(a) >> 24); uint32_t byteb = (ntohl(b) & 0xff); if (bytea == byteb && bytea != 0x00) { if (MATCH(a, ANY, 0x00, 0x00, 0x00) && MATCH(b, 0x00, 0x00, 0x00, ANY)) { return true; } } bytea = (ntohl(a) & 0xff); byteb = (ntohl(b) >> 24); if (bytea == byteb && bytea != 0x00) { if (MATCH(b, ANY, 0x00, 0x00, 0x00) && MATCH(a, 0x00, 0x00, 0x00, ANY)) { return true; } } return false; } static inline bool match_discord_01(uint32_t payload, uint32_t len) { if (len == 74 && MATCH(payload, 0x00, 0x01, 0x00, 0x46)) { return true; } return false; } static inline bool match_discord_02(uint32_t payload, uint32_t len) { if (len == 74 && MATCH(payload, 0x00, 0x02, 0x00, 0x46)) { return true; } return false; } static inline bool match_discord(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Discord voice call/chat */ if (match_discord_01(data->payload[0], data->payload_len[0])) { if (match_discord_02(data->payload[1], data->payload_len[1])) return true; } if (match_discord_01(data->payload[1], data->payload_len[1])) { if (match_discord_02(data->payload[0], data->payload_len[0])) return true; } if (discord_payload_match(data->payload[0], data->payload[1])) { if (data->payload_len[0] == 70 && data->payload_len[1] == 70) return true; } return false; } static lpi_module_t lpi_discord = { LPI_PROTO_UDP_DISCORD, LPI_CATEGORY_VOIP, "Discord", 19, match_discord }; void register_discord(LPIModuleMap *mod_map) { register_protocol(&lpi_discord, mod_map); } ================================================ FILE: lib/udp/lpi_dns.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_reordered_dns(lpi_data_t *data) { /* Unfortunately, UDP can get reordered so if there are multiple * queries in a flow we cannot guarantee that the first response * will have the same ID as the first query. */ /* Just try and match common request / response flag arrangements */ if (MATCH(data->payload[0], ANY, ANY, 0x01, 0x00)) { if (MATCH(data->payload[1], ANY, ANY, 0x81, 0x80)) return true; } if (MATCH(data->payload[1], ANY, ANY, 0x01, 0x00)) { if (MATCH(data->payload[0], ANY, ANY, 0x81, 0x80)) return true; } return false; } static inline bool match_dns_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* As loath as I am to do this, we probably shouldn't allow any DNS * on ports other than 53 */ if (data->server_port != 53 && data->client_port != 53) return false; if (match_dns(data)) return true; if (match_reordered_dns(data)) return true; return false; } static lpi_module_t lpi_dns_udp = { LPI_PROTO_UDP_DNS, LPI_CATEGORY_SERVICES, "DNS", 10, /* Not a high certainty */ match_dns_udp }; void register_dns_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_dns_udp, mod_map); } ================================================ FILE: lib/udp/lpi_dota2.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* DOTA 2 -- a popular multiplayer battleground game */ static inline bool match_dota2_20(uint32_t payload, uint32_t len) { if (len != 20) return false; if (MATCHSTR(payload, "\xff\xff\xff\xff")) return true; return false; } static inline bool match_dota2_30(uint32_t payload, uint32_t len) { if (len != 30) return false; if (MATCHSTR(payload, "\xff\xff\xff\xff")) return true; return false; } static inline bool match_dota2_0100(uint32_t payload, uint32_t len) { if (len == 216 && MATCH(payload, 0x01, 0x00, 0x73, 0x64)) return true; if (len == 416 && MATCH(payload, 0x01, 0x00, 0x73, 0x64)) return true; return false; } static inline bool match_dota2_0212(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x02, 0x12, ANY, ANY)) return true; return false; } static inline bool match_dota2_512(uint32_t payload, uint32_t len) { if (len == 512) { if (MATCH(payload, 0x20, 0x0e, 0x00, 0x0d)) return true; if (MATCH(payload, 0x20, 0x10, 0x00, 0x0d)) return true; } return false; } static inline bool match_dota2_24(uint32_t payload, uint32_t len) { if (len == 24 && MATCH(payload, 0x21, 0x0d, ANY, ANY)) return true; if (len == 26 && MATCH(payload, 0x21, 0x0d, ANY, ANY)) return true; return false; } static inline bool match_dota2(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_dota2_20(data->payload[0], data->payload_len[0])) { if (match_dota2_30(data->payload[1], data->payload_len[1])) return true; } if (match_dota2_20(data->payload[1], data->payload_len[1])) { if (match_dota2_30(data->payload[0], data->payload_len[0])) return true; } if (match_dota2_0100(data->payload[0], data->payload_len[0])) { if (match_dota2_0212(data->payload[1], data->payload_len[1])) return true; } if (match_dota2_0100(data->payload[1], data->payload_len[1])) { if (match_dota2_0212(data->payload[0], data->payload_len[0])) return true; } if (match_dota2_512(data->payload[0], data->payload_len[0])) { if (match_dota2_24(data->payload[1], data->payload_len[1])) return true; } if (match_dota2_512(data->payload[1], data->payload_len[1])) { if (match_dota2_24(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_dota2 = { LPI_PROTO_UDP_DOTA2, LPI_CATEGORY_GAMING, "DOTA2", 10, match_dota2 }; void register_dota2(LPIModuleMap *mod_map) { register_protocol(&lpi_dota2, mod_map); } ================================================ FILE: lib/udp/lpi_doyo.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Doyo -- Chinese service for downloading free games (especially * ones that you would otherwise have to buy!) */ static inline bool match_doyo_p2p(uint32_t payload, uint32_t len) { /* Not the strongest of rules, but not much we can do */ if (len == 56 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_doyo_nonzero(uint32_t payload, uint32_t len) { if (len == 20 && MATCH(payload, ANY, 0x00, 0x00, 0x00) && payload != 0) return true; return false; } static inline bool match_doyo(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_doyo_p2p(data->payload[0], data->payload_len[0])) { if (match_doyo_p2p(data->payload[1], data->payload_len[1])) return true; if (match_doyo_nonzero(data->payload[1], data->payload_len[1])) return true; } if (match_doyo_p2p(data->payload[1], data->payload_len[1])) { if (match_doyo_nonzero(data->payload[0], data->payload_len[0])) return true; } if (match_doyo_nonzero(data->payload[0], data->payload_len[0])) { if (match_doyo_nonzero(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_doyo = { LPI_PROTO_UDP_DOYO, LPI_CATEGORY_P2P, "DoyoP2P", 200, match_doyo }; void register_doyo(LPIModuleMap *mod_map) { register_protocol(&lpi_doyo, mod_map); } ================================================ FILE: lib/udp/lpi_driveshare.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_driveshare_payload(uint32_t pload, uint32_t len) { /* I *think* this is driveshare, which seems to do SMB-like things * on port 8109 UDP */ if (len == ntohl(pload)) { return true; } if (MATCH(pload, 0x00, 0x00, 0x00, 0x00) && len == 48) { return true; } return false; } static inline bool match_driveshare(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Add a port restriction here, just to be safe */ if (data->client_port != 8109 && data->server_port != 8109) return false; if (!match_driveshare_payload(data->payload[0], data->payload_len[0])) return false; if (!match_driveshare_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_driveshare = { LPI_PROTO_UDP_DRIVESHARE, LPI_CATEGORY_FILES, "DriveShare", 12, match_driveshare }; void register_driveshare(LPIModuleMap *mod_map) { register_protocol(&lpi_driveshare, mod_map); } ================================================ FILE: lib/udp/lpi_dtls.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* This is basically SSL for UDP. Used by AnyConnect. * It is possible that we can subclassify this traffic, e.g. maybe AnyConnect * is the only DTLS app that uses port 443 for instance... * * Thanks to Remy Mudingay for helping to identify this protocol */ static inline bool match_dtls(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* DTLS uses entirely different versioning to conventional TLS */ if (MATCH(data->payload[0], 0x17, 0x01, 0x00, 0x00)) { if (data->payload_len[1] == 0) return true; if (MATCH(data->payload[1], 0x17, 0x01, 0x00, 0x00)) return true; } if (MATCH(data->payload[1], 0x17, 0x01, 0x00, 0x00)) { if (data->payload_len[0] == 0) return true; } if (MATCHSTR(data->payload[0], "\x16\xfe\xff\x00")) { if (data->payload_len[1] == 0) return true; if (MATCHSTR(data->payload[1], "\x16\xfe\xff\x00")) return true; } if (MATCHSTR(data->payload[1], "\x16\xfe\xff\x00")) { if (data->payload_len[0] == 0) return true; } /* DTLS 1.2 */ if (MATCHSTR(data->payload[0], "\x16\xfe\xfd\x00")) { if (data->payload_len[1] == 0) return true; if (MATCHSTR(data->payload[1], "\x16\xfe\xfd\x00")) return true; } if (MATCHSTR(data->payload[1], "\x16\xfe\xfd\x00")) { if (data->payload_len[0] == 0) return true; } /* This is probably Google Duo -- consider separate protocol? */ if (MATCHSTR(data->payload[0], "\x17\xfe\xfd\x00")) { if (MATCHSTR(data->payload[1], "\x17\xfe\xfd\x00")) return true; } return false; } static lpi_module_t lpi_dtls = { LPI_PROTO_UDP_DTLS, LPI_CATEGORY_ENCRYPT, "DTLS", 100, match_dtls }; void register_dtls(LPIModuleMap *mod_map) { register_protocol(&lpi_dtls, mod_map); } ================================================ FILE: lib/udp/lpi_emule.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_emule_kad(uint32_t payload, uint32_t len) { /* Many of these can be tracked back to * http://easymule.googlecode.com/svn/trunk/src/WorkLayer/opcodes.h * * XXX Some of these are request/response pairs that we may need to * match together if we start getting false positives */ /* Bootstrap version 2 request and response */ if (MATCH(payload, 0xe4, 0x00, ANY, ANY) && len == 27) return true; if (MATCH(payload, 0xe4, 0x08, ANY, ANY) && len == 529) return true; /* Bootstrap version 2 request and response */ if (MATCH(payload, 0xe4, 0x01, 0x00, 0x00) && ( len == 2 || len == 18)) return true; if (MATCH(payload, 0xe4, 0x09, ANY, ANY) && len == 523) return true; if (MATCH(payload, 0xe4, 0x21, ANY, ANY) && len == 35) return true; if (MATCH(payload, 0xe4, 0x4b, ANY, ANY) && len == 19) return true; if (MATCH(payload, 0xe4, 0x11, ANY, ANY)) { return true; } if (MATCH(payload, 0xe4, 0x19, ANY, ANY)) { if (len == 22 || len == 38 || len == 28) return true; } if (MATCH(payload, 0xe4, 0x20, ANY, ANY) && len == 35) return true; if (MATCH(payload, 0xe4, 0x18, ANY, ANY) && len == 27) return true; if (MATCH(payload, 0xe4, 0x10, ANY, ANY) && len == 27) return true; if (MATCH(payload, 0xe4, 0x58, ANY, ANY) && len == 6) return true; if (MATCH(payload, 0xe4, 0x50, ANY, ANY) && len == 4) return true; if (MATCH(payload, 0xe4, 0x52, ANY, ANY) && len == 36) return true; if (MATCH(payload, 0xe4, 0x40, ANY, ANY) && len == 48) return true; if (MATCH(payload, 0xe4, 0x43, ANY, ANY) && len == 225) return true; if (MATCH(payload, 0xe4, 0x48, ANY, ANY) && len == 19) return true; if (MATCH(payload, 0xe4, 0x29, ANY, ANY)) { if (len == 119 || len == 69 || len == 294) return true; } if (MATCH(payload, 0xe4, 0x28, ANY, ANY)) { if (len == 119 || len == 69 || len == 294) return true; if (len == 44) return true; if (len == 269) return true; } return false; } static bool is_emule_udp(uint32_t payload, uint32_t len) { /* Mainly looking at Kad stuff here - Kad packets start with 0xe4 * for uncompressed and 0xe5 for compressed data */ if (MATCH(payload, 0xe5, 0x43, ANY, ANY)) return true; if (MATCH(payload, 0xe5, 0x08, 0x78, 0xda)) return true; if (MATCH(payload, 0xe5, 0x28, 0x78, 0xda)) return true; /* emule extensions */ if (MATCH(payload, 0xc5, 0x90, ANY, ANY)) { return true; } if (MATCH(payload, 0xc5, 0x91, ANY, ANY)) { return true; } if (MATCH(payload, 0xc5, 0x92, ANY, ANY) && (len == 2)) return true; if (MATCH(payload, 0xc5, 0x93, ANY, ANY) && (len == 2)) return true; if (MATCH(payload, 0xc5, 0x94, ANY, ANY)) { if (len >= 38 && len <= 70) return true; } /* 0xe3 covers conventional emule messages */ if (MATCH(payload, 0xe3, 0x9a, ANY, ANY)) return true; if (MATCH(payload, 0xe3, 0x9b, ANY, ANY)) return true; if (MATCH(payload, 0xe3, 0x96, ANY, ANY) && len == 6) return true; if (MATCH(payload, 0xe3, 0x97, ANY, ANY)) { if (len <= 34 && ((len - 2) % 4 == 0)) return true; } if (MATCH(payload, 0xe3, 0x92, ANY, ANY)) return true; if (MATCH(payload, 0xe3, 0x94, ANY, ANY)) return true; if (MATCH(payload, 0xe3, 0x98, ANY, ANY)) return true; if (MATCH(payload, 0xe3, 0x99, ANY, ANY)) return true; if (MATCH(payload, 0xe3, 0xa2, ANY, ANY) && len == 6) return true; if (MATCH(payload, 0xe3, 0xa3, ANY, ANY)) return true; if (match_emule_kad(payload, len)) return true; return false; } static inline bool match_emule_verycd(uint32_t payload, uint32_t len) { /* Later packets in the flow are clearly referencing eMule builds * and software, in particular VeryCD and xl build61 */ if (len != 31) return false; if (!MATCH(payload, 0x3b, 0x00, 0x00, 0x00)) return false; return true; } static inline bool match_emule_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_emule(data)) return true; if (data->payload_len[0] == 0 && is_emule_udp(data->payload[1], data->payload_len[1])) { return true; } if (data->payload_len[1] == 0 && is_emule_udp(data->payload[0], data->payload_len[0])) { return true; } if (is_emule_udp(data->payload[0], data->payload_len[0]) && is_emule_udp(data->payload[1], data->payload_len[1])) return true; /* Having doubts about the correctness of this rule, so disabling * for now. */ /* if (match_emule_verycd(data->payload[0], data->payload_len[0])) { if (data->payload_len[1] != 0) return true; } if (match_emule_verycd(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] != 0) return true; } */ return false; } static lpi_module_t lpi_emule_udp = { LPI_PROTO_UDP_EMULE, LPI_CATEGORY_P2P, "eMule_UDP", 11, match_emule_udp }; void register_emule_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_emule_udp, mod_map); } ================================================ FILE: lib/udp/lpi_emule_weak.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /** XXX This module is currently disabled due to a tendency to overmatch! */ static inline bool match_mystery_emule(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* These particular patterns occur frequently on port 4672, making * me think they're some sort of emule traffic but there is no * obvious documentation. The payloads appear to be random, which * is unlike all other emule traffic. The flows tend to consist of * only one or two packets in each direction. * * XXX Comparison with DPI tools suggest that this is indeed eMule! * */ if (data->payload_len[0] == 44 && data->payload_len[1] >= 38 && data->payload_len[1] <= 50) return true; if (data->payload_len[1] == 44 && data->payload_len[0] >= 38 && data->payload_len[0] <= 50) return true; if (data->payload_len[0] == 51 && (data->payload_len[1] == 135 || data->payload_len[1] == 85 || data->payload_len[1] == 310)) return true; if (data->payload_len[1] == 51 && (data->payload_len[0] == 135 || data->payload_len[0] == 85 || data->payload_len[0] == 310)) return true; return false; } static inline bool match_emule_weak_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This covers a particular branch of emule traffic which is harder * to reliably detect than even regular emule (which isn't great to * begin with). */ if (match_mystery_emule(data, NULL)) return true; return false; } static lpi_module_t lpi_emule_weak_udp = { LPI_PROTO_UDP_EMULE, LPI_CATEGORY_P2P, "eMule_UDP", 20, match_emule_weak_udp }; void register_emule_weak_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_emule_weak_udp, mod_map); } ================================================ FILE: lib/udp/lpi_epson.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_epson(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "EPSO")) return true; return false; } static lpi_module_t lpi_epson = { LPI_PROTO_UDP_EPSON, LPI_CATEGORY_PRINTING, "Epson", 5, match_epson }; void register_epson(LPIModuleMap *mod_map) { register_protocol(&lpi_epson, mod_map); } ================================================ FILE: lib/udp/lpi_eso.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_eso_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len == 40 && MATCH(payload, 0x00, ANY, ANY, ANY)) return true; if (len == 10 && MATCH(payload, 0x07, 0xa9, 0x00, 0x00)) return true; return false; } static inline bool match_eso(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* I'm pretty sure this is Ensemble game traffic, as it is the * only thing I can find matching the port 2300 that it commonly * occurs on. No game docs available, though :( */ if (!match_eso_payload(data->payload[0], data->payload_len[0])) return false; if (!match_eso_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_eso = { LPI_PROTO_UDP_ESO, LPI_CATEGORY_GAMING, "EnsembleOnline", 12, match_eso }; void register_eso(LPIModuleMap *mod_map) { register_protocol(&lpi_eso, mod_map); } ================================================ FILE: lib/udp/lpi_esp_encap.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_esp_encap(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This sucks, as the four bytes are the security association ID for * the flow. We can only really go on port numbers, although we can * identify IKE packets by looking for the Non-ESP marker (which is * all zeroes) * * Just have to match on ports, I guess :( */ if (data->server_port == 4500 && data->client_port == 4500) return true; /* If only one port is 4500, check for the Non-ESP marker */ if (data->server_port == 4500 || data->client_port == 4500) { if (data->payload[0] == 0 && data->payload[1] == 0) return true; } return false; } static lpi_module_t lpi_esp_encap = { LPI_PROTO_UDP_ESP, LPI_CATEGORY_TUNNELLING, "ESP_UDP", 200, /* This is a pretty terrible rule */ match_esp_encap }; void register_esp_encap(LPIModuleMap *mod_map) { register_protocol(&lpi_esp_encap, mod_map); } ================================================ FILE: lib/udp/lpi_ethernetip.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * * 255.255.255.255 192.168.10.105 44818 1136 17 1226525494.728 1226525530.720 0 888 00000000 .... 0 63000000 c... 24 * 192.168.10.105 192.168.10.120 1136 44818 17 1226525494.730 1226525530.722 2775 0 63003300 c.3. 75 00000000 .... 0 */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_command(uint32_t payload, uint16_t payload_len) { // the second uint16 of the ethernetip header is payload the length // but not including the header size of 24 bytes uint16_t len = ntohs((uint16_t)ntohl(payload)) + 24; if (payload_len != len) return false; // no op if (MATCH(payload, 0x00, 0x00, ANY, ANY)) return true; // list services if (MATCH(payload, 0x04, 0x00, ANY, ANY)) return true; // list identity if (MATCH(payload, 0x63, 0x00, ANY, ANY)) return true; // list interfaces if (MATCH(payload, 0x64, 0x00, ANY, ANY)) return true; // register session if (MATCH(payload, 0x65, 0x00, 0x04, 0x00)) return true; // un-register session if (MATCH(payload, 0x66, 0x00, ANY, ANY)) return true; // sendrrdata if (MATCH(payload, 0x6f, 0x00, ANY, ANY)) return true; // send unit data if (MATCH(payload, 0x70, 0x00, ANY, ANY)) return true; // indicate status if (MATCH(payload, 0x72, 0x00, ANY, ANY)) return true; // cancel if (MATCH(payload, 0x73, 0x00, ANY, ANY)) return true; // error if (MATCH(payload, 0xff, 0xff, ANY, ANY)) return true; return false; } static inline bool match_ethernetip_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 44818 && data->client_port != 44818) return false; if (match_command(data->payload[0], data->payload_len[0]) || match_command(data->payload[1], data->payload_len[1])) return true; return false; } static lpi_module_t lpi_ethernetip_udp = { LPI_PROTO_UDP_ETHERNETIP, LPI_CATEGORY_ICS, "EtherNet/IP_UDP", 100, match_ethernetip_udp }; void register_ethernetip_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_ethernetip_udp, mod_map); } ================================================ FILE: lib/udp/lpi_eye.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_eye_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "EYE1")) return true; return false; } static lpi_module_t lpi_eye_udp = { LPI_PROTO_UDP_EYE, LPI_CATEGORY_GAMING, "AllSeeingEye_UDP", 3, match_eye_udp }; void register_eye_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_eye_udp, mod_map); } ================================================ FILE: lib/udp/lpi_fasp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_fasp_out(uint32_t payload, uint32_t len) { if (MATCH(payload, ANY, 0x21, 0x00, 0x00)) return true; return false; } static inline bool match_fasp_in(uint32_t payload, uint32_t len) { if (len != 64) return false; if (MATCH(payload, ANY, 0x20, 0x00, 0x00)) return true; return false; } static inline bool match_fasp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* First byte must match in both directions */ if ((data->payload[0] & 0xff) != (data->payload[1] & 0xff)) { return false; } if (match_fasp_out(data->payload[0], data->payload_len[0])) { if (match_fasp_in(data->payload[1], data->payload_len[1])) return true; } if (match_fasp_out(data->payload[1], data->payload_len[1])) { if (match_fasp_in(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_fasp = { LPI_PROTO_UDP_FASP, LPI_CATEGORY_FILES, "FASP", 16, match_fasp }; void register_fasp(LPIModuleMap *mod_map) { register_protocol(&lpi_fasp, mod_map); } ================================================ FILE: lib/udp/lpi_feitwo.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_feitwo_sig(uint32_t payload) { if (MATCH(payload, 0x83, 0x80, 0x00, 0x01)) return true; return false; } static inline bool match_feitwo(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 3333 */ if (match_feitwo_sig(data->payload[0])) { if (match_feitwo_sig(data->payload[1])) { return true; } } return false; } static lpi_module_t lpi_feitwo = { LPI_PROTO_UDP_FEITWO, LPI_CATEGORY_P2P, "Feitwo", 112, match_feitwo }; void register_feitwo(LPIModuleMap *mod_map) { register_protocol(&lpi_feitwo, mod_map); } ================================================ FILE: lib/udp/lpi_forticlient_sslvpn.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_forti_vpn_48(uint32_t payload, uint32_t len) { if (len != 48 && len != 192) return false; if (MATCHSTR(payload, "\x16\xfe\xff\x00")) return true; return false; } static inline bool match_forti_vpn(uint32_t payload, uint32_t len) { if (MATCHSTR(payload, "\x16\xfe\xff\x00")) return true; return false; } static inline bool match_forti_fd_99(uint32_t payload, uint32_t len) { if (len == 99 && MATCHSTR(payload, "\x16\xfe\xfd\x00")) return true; return false; } static inline bool match_forticlient_sslvpn(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_forti_vpn_48(data->payload[0], data->payload_len[0])) { if (match_forti_vpn(data->payload[1], data->payload_len[1])) return true; if (match_forti_fd_99(data->payload[1], data->payload_len[1])) return true; } if (match_forti_vpn_48(data->payload[1], data->payload_len[1])) { if (match_forti_vpn(data->payload[0], data->payload_len[0])) return true; if (match_forti_fd_99(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_forticlient_sslvpn = { LPI_PROTO_UDP_FORTICLIENT_SSLVPN, LPI_CATEGORY_TUNNELLING, "FortiClientSSLVPN", 12, match_forticlient_sslvpn }; void register_forticlient_sslvpn(LPIModuleMap *mod_map) { register_protocol(&lpi_forticlient_sslvpn, mod_map); } ================================================ FILE: lib/udp/lpi_fortinet.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_fortinet_req(uint32_t payload, uint32_t len) { if (MATCHSTR(payload, "ikro")) return true; if (MATCHSTR(payload, "ikuo")) return true; /* All the following strings require a 64 byte datagram */ if (len != 64) return false; if (MATCHSTR(payload, "ihrk")) return true; if (MATCHSTR(payload, "ihri")) return true; if (MATCHSTR(payload, "iiri")) return true; if (MATCHSTR(payload, "ihrh")) return true; if (MATCHSTR(payload, "ihrj")) return true; if (MATCHSTR(payload, "ihro")) return true; if (MATCHSTR(payload, "iiro")) return true; if (MATCHSTR(payload, "ikri")) return true; if (MATCHSTR(payload, "ikvk")) return true; if (MATCHSTR(payload, "ikvo")) return true; return false; } static inline bool match_fortinet_resp(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len == 36 && MATCHSTR(payload, "kowO")) return true; if (len == 44 && MATCHSTR(payload, "kowG")) return true; if (len == 12 && MATCHSTR(payload, "nkwg")) return true; if (len == 32 && MATCHSTR(payload, "khwK")) return true; if (len == 64 && MATCHSTR(payload, "kkw+")) return true; return false; } static inline bool match_fortinet(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Seems to be part of the Fortinet update system */ if (match_fortinet_req(data->payload[0], data->payload_len[0])) { if (match_fortinet_resp(data->payload[1], data->payload_len[1])) return true; } if (match_fortinet_req(data->payload[1], data->payload_len[1])) { if (match_fortinet_resp(data->payload[0], data->payload_len[0])) return true; } if (match_str_either(data, "Comm")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } return false; } static lpi_module_t lpi_fortinet = { LPI_PROTO_UDP_FORTINET, LPI_CATEGORY_SECURITY, "Fortinet", 3, match_fortinet }; void register_fortinet(LPIModuleMap *mod_map) { register_protocol(&lpi_fortinet, mod_map); } ================================================ FILE: lib/udp/lpi_foscam.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* All Foscam traffic begins with 0xf1. Bytes 3 and 4 are a length field */ static inline bool match_fcam_probe(uint32_t payload, uint32_t len) { if (len == 4 && MATCH(payload, 0xf1, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_fcam_probereply(uint32_t payload, uint32_t len) { if (len == 20 && MATCH(payload, 0xf1, 0x01, 0x00, 0x10)) return true; return false; } static inline bool match_fcam_4(uint32_t payload, uint32_t len) { if (len == 4 && MATCH(payload, 0xf1, 0x03, 0x00, 0x00)) return true; return false; } static inline bool match_fcam_70(uint32_t payload, uint32_t len) { if (len == 4 && MATCH(payload, 0xf1, 0x70, 0x00, 0x00)) return true; return false; } static inline bool match_fcam_32(uint32_t payload, uint32_t len) { if (len == 32 && MATCH(payload, 0xf1, 0x83, 0x00, 0x1c)) return true; return false; } static inline bool match_fcam_p2p_ping(uint32_t payload, uint32_t len) { if (len != 60 && len != 288) { return false; } if (MATCH(payload, 0x3e, 0x2f, 0x8d, 0xcc)) { return true; } return false; } static inline bool match_fcam_p2p_pong(uint32_t payload, uint32_t len) { if (len != 60 && len != 288) { return false; } if (MATCH(payload, 0x7e, 0x2a, 0x9d, 0xec)) { return true; } return false; } static inline bool match_foscam(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_fcam_4(data->payload[0], data->payload_len[0])) { if (match_fcam_32(data->payload[1], data->payload_len[1])) return true; if (match_fcam_70(data->payload[1], data->payload_len[1])) return true; } if (match_fcam_4(data->payload[1], data->payload_len[1])) { if (match_fcam_32(data->payload[0], data->payload_len[0])) return true; if (match_fcam_70(data->payload[0], data->payload_len[0])) return true; } if (match_fcam_probe(data->payload[0], data->payload_len[0])) { if (match_fcam_probereply(data->payload[1], data->payload_len[1])) return true; } if (match_fcam_probe(data->payload[1], data->payload_len[1])) { if (match_fcam_probereply(data->payload[0], data->payload_len[0])) return true; } /* Periodic pings and replies seemingly sent by Foscam cameras to * servers on the internet (port 10001) * More info: * http://foscam.us/forum/foscam-dialing-out-to-suspect-hosts-t17699.html */ if (data->payload_len[0] == data->payload_len[1] && (data->server_port == 10001 || data->client_port == 10001)) { if (match_fcam_p2p_ping(data->payload[0], data->payload_len[0])) { if (match_fcam_p2p_pong(data->payload[1], data->payload_len[1])) return true; } if (match_fcam_p2p_ping(data->payload[1], data->payload_len[1])) { if (match_fcam_p2p_pong(data->payload[0], data->payload_len[0])) return true; } } return false; } static lpi_module_t lpi_foscam = { LPI_PROTO_UDP_FOSCAM, LPI_CATEGORY_IPCAMERAS, "Foscam", 100, match_foscam }; void register_foscam(LPIModuleMap *mod_map) { register_protocol(&lpi_foscam, mod_map); } ================================================ FILE: lib/udp/lpi_freechal.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_freechal(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "GET ", "FCP2")) return true; return false; } static lpi_module_t lpi_freechal = { LPI_PROTO_UDP_FREECHAL, LPI_CATEGORY_P2P, "FreeChal_UDP", 3, match_freechal }; void register_freechal(LPIModuleMap *mod_map) { register_protocol(&lpi_freechal, mod_map); } ================================================ FILE: lib/udp/lpi_freefire.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Battle royale game for mobile from Garena */ static inline bool match_ff_0101(uint32_t payload, uint32_t len) { if (len == 28 && MATCH(payload, 0x6c, ANY, 0x01, 0x01)) return true; return false; } static inline bool match_ff_0002(uint32_t payload, uint32_t len) { if (len == 14 && MATCH(payload, 0x6c, 0x65, 0x00, 0x02)) return true; return false; } static inline bool match_freefire(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Ports are in 1000-10005 range */ if (match_ff_0101(data->payload[0], data->payload_len[0])) { if (match_ff_0002(data->payload[1], data->payload_len[1])) { return true; } } if (match_ff_0101(data->payload[1], data->payload_len[1])) { if (match_ff_0002(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_freefire = { LPI_PROTO_UDP_FREEFIRE, LPI_CATEGORY_GAMING, "FreeFire", 101, match_freefire }; void register_freefire(LPIModuleMap *mod_map) { register_protocol(&lpi_freefire, mod_map); } ================================================ FILE: lib/udp/lpi_funshion.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" #include /* Funshion is a Chinese P2PTV application that seems to use a bunch * of different protocols / messages. */ static inline bool match_funshion_25(uint32_t payload, uint32_t len) { /* One-way flows are also common, but we'd need a stronger set * of rules before I'd feel comfortable allowing this. */ if (len != 25) return false; /* The payload here is almost definitely a timestamp, but it only * bears an approximate resemblance to the timestamp of the packet * itself. * Sometimes it is up to a day in excess of the current timestamp, * sometimes it is several hours behind. * * Not much chance of doing any useful matches on the payload. */ return true; } static inline bool match_funshion_104(uint32_t payload, uint32_t len) { /* The payload for these packets is all zeroes, so be careful * regarding false positives, e.g. XboxLive traffic. */ if (len == 0) return true; if (len != 104) return false; if (MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_funshion_dt(uint32_t payload, uint32_t otherlen) { if (otherlen != 0) return false; /* The 'command' begins with byte 4, so I'm going to try * and match all known commands rather than just allowing * anything in byte 4. * * We might miss a few rare commands but should get the * common ones. */ /* init, inline_page */ if (MATCH(payload, 'd', 't', '=', 'i')) return true; /* dtfsp, dtjs */ if (MATCH(payload, 'd', 't', '=', 'd')) return true; /* play_* */ if (MATCH(payload, 'd', 't', '=', 'p')) return true; /* wt_bh */ if (MATCH(payload, 'd', 't', '=', 'w')) return true; /* taskflux */ if (MATCH(payload, 'd', 't', '=', 't')) return true; /* compress_uncompress */ if (MATCH(payload, 'd', 't', '=', 'c')) return true; return false; } static inline bool match_funshion_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_funshion_25(data->payload[0], data->payload_len[0])) { if (match_funshion_25(data->payload[1], data->payload_len[1])) return true; } if (match_funshion_104(data->payload[0], data->payload_len[0])) { if (match_funshion_104(data->payload[1], data->payload_len[1])) return true; } if (match_funshion_dt(data->payload[0], data->payload_len[1])) return true; if (match_funshion_dt(data->payload[1], data->payload_len[0])) return true; return false; } static lpi_module_t lpi_funshion_udp = { LPI_PROTO_UDP_FUNSHION, LPI_CATEGORY_P2PTV, "Funshion_UDP", 50, match_funshion_udp }; void register_funshion_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_funshion_udp, mod_map); } ================================================ FILE: lib/udp/lpi_gamespy.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_gamespy(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "\\sta")) return true; if (match_str_either(data, "\\inf")) return true; if (match_str_either(data, "\\gam")) return true; if (match_str_either(data, "\\hos")) return true; if (match_str_either(data, "\\bas")) return true; /* Gamespy request begins with 0xfe 0xfd FOO BAR. The response begins * with FOO BAR, where FOO and BAR are specific bytes */ if (MATCH(data->payload[0], 0xfe, 0xfd, ANY, ANY) && ((data->payload[1] << 16) == (data->payload[0] & 0xffff0000))) return true; if (MATCH(data->payload[1], 0xfe, 0xfd, ANY, ANY) && ((data->payload[0] << 16) == (data->payload[1] & 0xffff0000))) return true; /* These packets have also been observed between gamespy servers * and for gamespy-powered games, e.g. GTA 4 */ if (match_str_both(data, "\xfd\xfc\x1e\x66", "\xfd\xfc\x1e\x66")) return true; if (match_str_either(data, "\xfd\xfc\x1e\x66")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } return false; } static lpi_module_t lpi_gamespy = { LPI_PROTO_UDP_GAMESPY, LPI_CATEGORY_GAMING, "GameSpy", 3, match_gamespy }; void register_gamespy(LPIModuleMap *mod_map) { register_protocol(&lpi_gamespy, mod_map); } ================================================ FILE: lib/udp/lpi_ganglia.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Ganglia -- monitoring for clusters / grid computing */ static inline bool match_gangmsg(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x00, 0x00, 0x00, 0x80)) { /* The payload usually contains a host name so can * vary a fair bit. */ if (len >= 100 && len <= 250) { return true; } } return false; } static inline bool match_ganglia(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 8649 && data->client_port != 8649) { return false; } if (match_gangmsg(data->payload[0], data->payload_len[0])) { if (data->payload_len[1] == 0) return true; } if (match_gangmsg(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] == 0) return true; } return false; } static lpi_module_t lpi_ganglia = { LPI_PROTO_UDP_GANGLIA, LPI_CATEGORY_MONITORING, "Ganglia", 50, match_ganglia }; void register_ganglia(LPIModuleMap *mod_map) { register_protocol(&lpi_ganglia, mod_map); } ================================================ FILE: lib/udp/lpi_gangsofspace.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_gos_37(uint32_t payload, uint32_t len) { /* bytes 3 and 4 appear to be a length field */ if (len == 37 && MATCH(payload, 0x07, 0x00, 0x00, 0x21)) return true; return false; } static inline bool match_gos_45(uint32_t payload, uint32_t len) { /* bytes 3 and 4 appear to be a length field */ if (len == 45 && MATCH(payload, 0x07, 0x00, 0x00, 0x29)) return true; return false; } static inline bool match_gangsofspace(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_gos_37(data->payload[0], data->payload_len[0])) { if (match_gos_45(data->payload[1], data->payload_len[1])) return true; } if (match_gos_37(data->payload[1], data->payload_len[1])) { if (match_gos_45(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_gangsofspace = { LPI_PROTO_UDP_GANGSOFSPACE, LPI_CATEGORY_GAMING, "GangsOfSpace", 12, match_gangsofspace }; void register_gangsofspace(LPIModuleMap *mod_map) { register_protocol(&lpi_gangsofspace, mod_map); } ================================================ FILE: lib/udp/lpi_garena.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_garena(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* http://garenalinux.pastebay.com/71533 */ if (data->server_port == 53 || data->client_port == 53) return false; /* Garena is NOT always on port 1513 */ /* Matching HELLO in each direction */ if (MATCH(data->payload[0], 0x02, 0x00, 0x00, 0x00)) { if (data->payload_len[0] != 16) return false; if (data->payload_len[1] == 0) return true; if (data->payload_len[1] != 16) return false; if (MATCH(data->payload[1], 0x02, 0x00, 0x00, 0x00)) return true; if (MATCH(data->payload[1], 0x0f, 0x00, 0x00, 0x00)) return true; return false; } if (MATCH(data->payload[1], 0x02, 0x00, 0x00, 0x00)) { if (data->payload_len[1] != 16) return false; if (data->payload_len[0] == 0) return true; if (data->payload_len[0] != 16) return false; if (MATCH(data->payload[0], 0x02, 0x00, 0x00, 0x00)) return true; if (MATCH(data->payload[0], 0x0f, 0x00, 0x00, 0x00)) return true; return false; } return false; } static lpi_module_t lpi_garena = { LPI_PROTO_UDP_GARENA, LPI_CATEGORY_GAMING, "Garena_UDP", 5, match_garena }; void register_garena(LPIModuleMap *mod_map) { register_protocol(&lpi_garena, mod_map); } ================================================ FILE: lib/udp/lpi_gearsofwar.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_gow_44(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x00, 0x00, 0x00, 0x00) && len == 44) return true; return false; } static inline bool match_gow_51(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x00, 0x00, 0x00, 0x00) && len == 51) return true; return false; } static inline bool match_gow_port(uint32_t sp, uint32_t cp) { if (sp == 30200 || cp == 30200) return true; if (sp == 30400 || cp == 30400) return true; if (sp == 30600 || cp == 30600) return true; if (sp == 31000 || cp == 31000) return true; if (sp == 30800 || cp == 30800) return true; if (sp == 30000 || cp == 30000) return true; return false; } static inline bool match_gearsofwar(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_gow_port(data->server_port, data->client_port)) return false; if (match_gow_44(data->payload[0], data->payload_len[0])) { if (match_gow_51(data->payload[1], data->payload_len[1])) return true; } if (match_gow_44(data->payload[1], data->payload_len[1])) { if (match_gow_51(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_gearsofwar = { LPI_PROTO_UDP_GEARSOFWAR, LPI_CATEGORY_GAMING, "GearsOfWar", 199, match_gearsofwar }; void register_gearsofwar(LPIModuleMap *mod_map) { register_protocol(&lpi_gearsofwar, mod_map); } ================================================ FILE: lib/udp/lpi_gnutella.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_gnutella_maint(lpi_data_t *data) { /* All Gnutella UDP communications begin with a random 16 byte * message ID - the request and the response must have the same * message ID */ /* OK, for now I'm going to just work with two-way exchanges, because * one-way is going to be pretty unreliable :( */ /* One exception! Unanswered PINGs */ if (data->payload_len[0] == 23 && data->payload_len[1] == 0) return true; if (data->payload_len[1] == 23 && data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0 || data->payload_len[0] == 0) return false; /* There seem to be some message types that do weird stuff with the * GUID - I suspect they are Limewire extensions. */ if (data->payload_len[0] == 23 && data->payload_len[1] == 23) { if (match_chars_either(data, 0x00, 0x00, 0x00, 0x00)) return true; } /* If there is payload in both directions, the message IDs must match */ if (data->payload[0] != data->payload[1]) return false; /* All of these payload combinations are based purely on transactions * observed on UDP port 6346 (a known Gnutella port) - sadly, there's * no genuinely good documentation on the typical size of Gnutella * UDP requests */ /* PING */ /* if (data->payload_len[0] == 23 && data->payload_len[1] < 100) return true; if (data->payload_len[1] == 23 && data->payload_len[0] < 100) return true; */ /* 727 byte packets are matched with 81 or 86 byte packets */ if (data->payload_len[0] == 727 && (data->payload_len[1] == 81 || data->payload_len[1] == 86)) return true; if (data->payload_len[1] == 727 && (data->payload_len[0] == 81 || data->payload_len[0] == 86)) return true; /* 72 and (61 or 81 or 86) byte packets seem to go together */ if (data->payload_len[0] == 72) { if (data->payload_len[1] == 61) return true; if (data->payload_len[1] == 81) return true; if (data->payload_len[1] == 86) return true; } if (data->payload_len[1] == 72) { if (data->payload_len[0] == 61) return true; if (data->payload_len[0] == 81) return true; if (data->payload_len[0] == 86) return true; } /* 81 and 544 */ if (data->payload_len[0] == 81 && data->payload_len[1] == 544) return true; if (data->payload_len[1] == 81 && data->payload_len[0] == 544) return true; /* 55 and 47 */ if (data->payload_len[0] == 55 && data->payload_len[1] == 47) return true; if (data->payload_len[1] == 55 && data->payload_len[0] == 47) return true; /* 38 and 96 */ if (data->payload_len[0] == 38 && data->payload_len[1] == 96) return true; if (data->payload_len[1] == 38 && data->payload_len[0] == 96) return true; /* 67 and (81 or 86) */ if (data->payload_len[0] == 67 && (data->payload_len[1] == 81 || data->payload_len[1] == 86)) return true; if (data->payload_len[1] == 67 && (data->payload_len[0] == 81 || data->payload_len[0] == 86)) return true; /* 29 byte requests seem to be met with 80-100 byte responses OR * a 46 byte response */ if (data->payload_len[0] == 29) { if (data->payload_len[1] <= 100 && data->payload_len[1] >= 80) return true; if (data->payload_len[1] == 46) return true; } if (data->payload_len[1] == 29) { if (data->payload_len[0] <= 100 && data->payload_len[0] >= 80) return true; if (data->payload_len[0] == 46) return true; } /* 34 byte requests seem to be met with 138-165 byte responses */ if (data->payload_len[0] == 34 && (data->payload_len[1] <= 165 && data->payload_len[1] >= 138)) return true; if (data->payload_len[1] == 34 && (data->payload_len[0] <= 165 && data->payload_len[0] >= 138)) return true; /* 193 matches 108 or 111 */ if (data->payload_len[0] == 193 && (data->payload_len[1] == 108 || data->payload_len[1] == 111)) return true; if (data->payload_len[1] == 193 && (data->payload_len[0] == 108 || data->payload_len[0] == 111)) return true; return false; } /* http://wiki.limewire.org/index.php?title=Out_of_Band_System */ static inline bool match_gnutella_oob(lpi_data_t *data) { /* DANGER: anonymised IP addresses! */ if (!match_ip_address_both(data)) return false; /* Payload size seems to be either 32 or 33 bytes */ if (data->payload_len[0] == 32 || data->payload_len[1] == 32) return true; if (data->payload_len[0] == 33 || data->payload_len[1] == 33) return true; return false; } static inline bool match_gnutella_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_gnutella_oob(data)) return true; if (match_gnutella_maint(data)) return true; return false; } static lpi_module_t lpi_gnutella_udp = { LPI_PROTO_UDP_GNUTELLA, LPI_CATEGORY_P2P, "Gnutella_UDP", 110, /* Rules are pretty dodgy so make this low priority */ match_gnutella_udp }; void register_gnutella_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_gnutella_udp, mod_map); } ================================================ FILE: lib/udp/lpi_gnutella2.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_gnutella2_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_chars_either(data, 'G', 'N', 'D', ANY)) return true; return false; } static lpi_module_t lpi_gnutella2_udp = { LPI_PROTO_UDP_GNUTELLA2, LPI_CATEGORY_P2P, "Gnutella2_UDP", 3, match_gnutella2_udp }; void register_gnutella2_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_gnutella2_udp, mod_map); } ================================================ FILE: lib/udp/lpi_gnutella_weak.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_gnutella_weak(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Not confident in this rule at all in terms of not creating * false positives. Need to *regularly* check up on this one * and make sure we're not over-matching */ if (data->payload_len[0] == 31 && data->payload_len[1] == 0) return true; if (data->payload_len[1] == 31 && data->payload_len[0] == 1) return true; return false; } static lpi_module_t lpi_gnutella_weak = { LPI_PROTO_UDP_GNUTELLA, LPI_CATEGORY_P2P, "Gnutella_UDP", 220, match_gnutella_weak }; void register_gnutella_weak(LPIModuleMap *mod_map) { register_protocol(&lpi_gnutella_weak, mod_map); } ================================================ FILE: lib/udp/lpi_gotomeeting.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_gtm_ping(uint32_t payload, uint32_t len) { if (len == 16 && MATCH(payload, 'P', 'I', 'N', 'G')) return true; return false; } static inline bool match_gtm_pong(uint32_t payload, uint32_t len) { if (len == 16 && MATCH(payload, 'P', 'O', 'N', 'G')) return true; return false; } static inline bool match_gtm_webcam(uint32_t ploada, uint32_t ploadb) { /* Bytes 2,3,4 match, but be careful not to match stuff like * 0x000000 */ if (MATCH(ploada, ANY, 0x00, 0x00, 0x00)) return false; if ((ploada & 0xffffff00) == (ploadb & 0xffffff00)) return true; return false; } static inline bool match_gotomeeting(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* VOIP tends to be on port 8200 */ if (match_gtm_ping(data->payload[0], data->payload_len[0])) { if (match_gtm_pong(data->payload[1], data->payload_len[1])) return true; } if (match_gtm_ping(data->payload[1], data->payload_len[1])) { if (match_gtm_pong(data->payload[0], data->payload_len[0])) return true; } /* Webcam goes over port 1853 */ if (match_gtm_webcam(data->payload[0], data->payload[1])) { if (data->server_port == 1853 || data->client_port == 1853) return true; } return false; } static lpi_module_t lpi_gotomeeting = { LPI_PROTO_UDP_GOTOMEETING, LPI_CATEGORY_VOIP, "GoToMeeting", 149, match_gotomeeting }; void register_gotomeeting(LPIModuleMap *mod_map) { register_protocol(&lpi_gotomeeting, mod_map); } ================================================ FILE: lib/udp/lpi_gprs_tunnel.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_gtp_payload(uint32_t payload, uint32_t len) { uint32_t swap = ntohl(payload); uint32_t replen = swap & 0x0000ffff; if (len == 0) return true; if (len != replen) return false; if ((swap & 0xf0ff0000) != 0x30010000) { return false; } return true; } static inline bool match_gprs_tunnel(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_gtp_payload(data->payload[0], data->payload_len[0])) { if (match_gtp_payload(data->payload[1], data->payload_len[1])) return true; } if (match_gtp_payload(data->payload[1], data->payload_len[1])) { if (match_gtp_payload(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_gprs_tunnel = { LPI_PROTO_UDP_GPRS_TUNNEL, LPI_CATEGORY_TUNNELLING, "GPRS_Tunnelling", 10, match_gprs_tunnel }; void register_gprs_tunnel(LPIModuleMap *mod_map) { register_protocol(&lpi_gprs_tunnel, mod_map); } ================================================ FILE: lib/udp/lpi_gsm.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_gsm(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* There are other commands but these are the only ones I've seen in * the wild so far */ if (match_str_either(data, "+CSQ")) return true; if (match_str_either(data, "+CIM")) return true; return false; } static lpi_module_t lpi_gsm = { LPI_PROTO_UDP_GSM, LPI_CATEGORY_MONITORING, "GSM", 3, match_gsm }; void register_gsm(LPIModuleMap *mod_map) { register_protocol(&lpi_gsm, mod_map); } ================================================ FILE: lib/udp/lpi_h1z1.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Appears to be H1Z1, an early access MMO (DayZ clone) from Sony Online */ static inline bool match_h1z1_req1(uint32_t payload, uint32_t len) { if (len == 25 && MATCH(payload, 0x00, 0x01, 0x00, 0x00)) return true; return false; } static inline bool match_h1z1_resp1(uint32_t payload, uint32_t len) { if (len == 21 && MATCH(payload, 0x00, 0x02, ANY, ANY)) return true; return false; } static inline bool match_h1z1_req2(uint32_t payload, uint32_t len) { if (len == 35 && MATCH(payload, 0x00, 0x01, 0x00, 0x00)) return true; return false; } static inline bool match_h1z1_resp2(uint32_t payload, uint32_t len) { if (len == 6 && MATCH(payload, 0x00, 0x15, ANY, ANY)) return true; return false; } static inline bool match_h1z1(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* There are a couple of request / response patterns */ if (match_h1z1_req1(data->payload[1], data->payload_len[1])) { if (match_h1z1_resp1(data->payload[0], data->payload_len[0])) return true; } if (match_h1z1_req1(data->payload[0], data->payload_len[0])) { if (match_h1z1_resp1(data->payload[1], data->payload_len[1])) return true; } if (match_h1z1_req2(data->payload[1], data->payload_len[1])) { if (match_h1z1_resp2(data->payload[0], data->payload_len[0])) return true; } if (match_h1z1_req2(data->payload[0], data->payload_len[0])) { if (match_h1z1_resp2(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_h1z1 = { LPI_PROTO_UDP_H1Z1, LPI_CATEGORY_GAMING, "H1Z1", 25, match_h1z1 }; void register_h1z1(LPIModuleMap *mod_map) { register_protocol(&lpi_h1z1, mod_map); } ================================================ FILE: lib/udp/lpi_halflife.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_halflife_ports(lpi_data_t *data) { if (data->server_port >= 27000 && data->server_port < 28000) return true; if (data->client_port >= 27000 && data->client_port < 28000) return true; return false; } static inline bool match_halflife_nine(uint32_t payload, uint32_t len) { if (len != 9) return false; if (!MATCHSTR(payload, "\xff\xff\xff\xff")) return false; return true; } static inline bool match_halflife_generic(uint32_t payload, uint32_t len) { if (len == 0) return true; if (!MATCHSTR(payload, "\xff\xff\xff\xff")) return false; return true; } static inline bool match_halflife(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_halflife_nine(data->payload[0], data->payload_len[0])) { if (match_halflife_nine(data->payload[1], data->payload_len[1])) return true; } if (!match_halflife_ports(data)) return false; /* if (match_halflife_generic(data->payload[0], data->payload_len[0])) { if (match_halflife_generic(data->payload[1], data->payload_len[1])) return true; } */ return false; } static lpi_module_t lpi_halflife = { LPI_PROTO_UDP_HL, LPI_CATEGORY_GAMING, "HalfLife", 100, /* Make sure this comes after other similar game protocols, * e.g. ARMA, Quake */ match_halflife }; void register_halflife(LPIModuleMap *mod_map) { register_protocol(&lpi_halflife, mod_map); } ================================================ FILE: lib/udp/lpi_haloonline.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Halo Online -- multiplayer FPS that has already been shut down but is * somehow still being played by FPS "aficionados". */ static inline bool match_bla_17(uint32_t payload, uint32_t len) { if (len == 17 && MATCH(payload, 0x01, 'b', 'l', 'a')) return true; return false; } static inline bool match_bla_86(uint32_t payload, uint32_t len) { if (len == 86 && MATCH(payload, 0x01, 'b', 'l', 'a')) return true; return false; } static inline bool match_haloonline(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 11774 */ if (match_bla_17(data->payload[0], data->payload_len[0])) { if (match_bla_86(data->payload[1], data->payload_len[1])) return true; } if (match_bla_17(data->payload[1], data->payload_len[1])) { if (match_bla_86(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_haloonline = { LPI_PROTO_UDP_HALO_ONLINE, LPI_CATEGORY_GAMING, "HaloOnline", 5, match_haloonline }; void register_haloonline(LPIModuleMap *mod_map) { register_protocol(&lpi_haloonline, mod_map); } ================================================ FILE: lib/udp/lpi_hamachi.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_hamachi(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Based on traffic observed on port 17771 where one endpoint is in * an IP range owned by LogMeIn */ if (!MATCH(data->payload[0], 0x00, 0x00, 0x00, 0x00)) return false; if (!MATCH(data->payload[1], 0x00, 0x00, 0x00, 0x00)) return false; if (data->payload_len[0] != 76) return false; if (data->payload_len[1] != 76) return false; return true; } static lpi_module_t lpi_hamachi = { LPI_PROTO_UDP_HAMACHI, LPI_CATEGORY_TUNNELLING, "Hamachi_UDP", 8, match_hamachi }; void register_hamachi_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_hamachi, mod_map); } ================================================ FILE: lib/udp/lpi_heliborne.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_hb_60(uint32_t payload, uint32_t len) { if (len == 60 && MATCHSTR(payload, "\xff\xff\xcc\x01")) return true; return false; } static inline bool match_hb_76(uint32_t payload, uint32_t len) { if (len == 76 && MATCH(payload, 0x00, 0x00, 0x00, 0x02)) return true; if (len == 80 && MATCH(payload, 0x00, 0x00, 0xcc, 0x02)) return true; return false; } static inline bool match_heliborne(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Ports 5055 and 5056 */ if (match_hb_60(data->payload[0], data->payload_len[0])) { if (match_hb_76(data->payload[1], data->payload_len[1])) return true; } if (match_hb_60(data->payload[1], data->payload_len[1])) { if (match_hb_76(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_heliborne = { LPI_PROTO_UDP_HELIBORNE, LPI_CATEGORY_GAMING, "Heliborne", 49, match_heliborne }; void register_heliborne(LPIModuleMap *mod_map) { register_protocol(&lpi_heliborne, mod_map); } ================================================ FILE: lib/udp/lpi_heroes_generals.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_hg_149(uint32_t payload, uint32_t len) { if (len == 149 && MATCHSTR(payload, "\xff\xff\xff\xff")) return true; return false; } static inline bool match_hg_1400(uint32_t payload, uint32_t len) { /* MTU could affect this XXX */ if (len != 1400) return false; /* Bits 5-8 of the first byte are always 0 -- rest is random */ if ((payload & 0x0000000f) != 0x00000000) return false; return true; } static inline bool match_heroes_generals(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_hg_149(data->payload[0], data->payload_len[0])) { if (match_hg_1400(data->payload[1], data->payload_len[1])) return true; } if (match_hg_149(data->payload[1], data->payload_len[1])) { if (match_hg_1400(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_heroes_generals = { LPI_PROTO_UDP_HEROES_GENERALS, LPI_CATEGORY_GAMING, "HeroesAndGenerals", 20, match_heroes_generals }; void register_heroes_generals(LPIModuleMap *mod_map) { register_protocol(&lpi_heroes_generals, mod_map); } ================================================ FILE: lib/udp/lpi_heroesevolved.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Mobile MOBA from R2Games */ static inline bool match_he(uint32_t payload, uint32_t len) { if (len == 5 && MATCH(payload, 0xdc, 'H', 'E', 0xe4)) return true; return false; } static inline bool match_ffff(uint32_t payload, uint32_t len) { if (len == 17 && MATCHSTR(payload, "\x01\x00\xff\xff")) return true; return false; } static inline bool match_heroesevolved(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_he(data->payload[0], data->payload_len[0])) { if (match_ffff(data->payload[1], data->payload_len[1])) return true; } if (match_he(data->payload[1], data->payload_len[1])) { if (match_ffff(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_heroesevolved = { LPI_PROTO_UDP_HEROES_EVOLVED, LPI_CATEGORY_GAMING, "HeroesEvolved", 50, match_heroesevolved }; void register_heroesevolved(LPIModuleMap *mod_map) { register_protocol(&lpi_heroesevolved, mod_map); } ================================================ FILE: lib/udp/lpi_hollachat.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_holla_header(uint32_t payload, uint32_t len) { uint32_t hdrlen; uint16_t swapped; hdrlen = ntohl(payload) >> 16; swapped = bswap_be_to_host16((uint16_t)hdrlen); if (len == swapped && MATCH(payload, ANY, ANY, 0x01, 0x00)) return true; return false; } static inline bool restrict_port(uint16_t porta, uint16_t portb) { if (porta == 5888 || portb == 5888) return true; if (porta >= 4000 && porta <= 4010) return true; if (portb >= 4000 && portb <= 4010) return true; return false; } static inline bool match_hollachat(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Ports 5888 and 4000-4009 are common */ if (restrict_port(data->server_port, data->client_port) == false) { return false; } if (match_holla_header(data->payload[0], data->payload_len[0])) { if (match_holla_header(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_hollachat = { LPI_PROTO_UDP_HOLLA, LPI_CATEGORY_CHAT, "HollaChat", 210, match_hollachat }; void register_hollachat(LPIModuleMap *mod_map) { register_protocol(&lpi_hollachat, mod_map); } ================================================ FILE: lib/udp/lpi_hots.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Heroes of the Storm -- Blizzard MOBA */ static inline bool match_hots_zero(uint32_t payload, uint32_t len) { if (len == 20 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_hots_other(uint32_t payload, uint32_t len) { if (len == 20 && MATCH(payload, ANY, ANY, 0x01, 0x00)) return true; if (len == 20 && MATCH(payload, ANY, ANY, 0x02, 0x00)) return true; if (len == 20 && MATCH(payload, ANY, ANY, 0x03, 0x00)) return true; if (len == 20 && MATCH(payload, ANY, ANY, 0x04, 0x00)) return true; if (len == 20 && MATCH(payload, ANY, ANY, 0x05, 0x00)) return true; if (len == 20 && MATCH(payload, ANY, ANY, 0x06, 0x00)) return true; if (len == 20 && MATCH(payload, ANY, ANY, 0x07, 0x00)) return true; if (len == 20 && MATCH(payload, ANY, ANY, 0x08, 0x00)) return true; if (len == 20 && MATCH(payload, ANY, ANY, 0x00, 0x00)) { if (MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return false; return true; } return false; } static inline bool match_hots(lpi_data_t *data, lpi_module_t *mod UNUSED) { bool validport = false; if (data->server_port == 1119 || data->client_port == 1119) validport = true; if (data->server_port == 3724 || data->client_port == 3724) validport = true; if (!validport) return false; if (match_hots_zero(data->payload[0], data->payload_len[0])) { if (match_hots_other(data->payload[1], data->payload_len[1])) return true; } if (match_hots_zero(data->payload[1], data->payload_len[1])) { if (match_hots_other(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_hots = { LPI_PROTO_UDP_HOTS, LPI_CATEGORY_GAMING, "HeroesOfTheStorm", 101, match_hots }; void register_hots(LPIModuleMap *mod_map) { register_protocol(&lpi_hots, mod_map); } ================================================ FILE: lib/udp/lpi_icp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_icp_query(uint32_t payload, uint32_t len) { uint32_t stated_len = 0; stated_len = ntohl(payload) & 0xffff; if (stated_len != len) return false; /* Just going to match v2 for now */ if (MATCH(payload, 0x01, 0x02, ANY, ANY)) return true; return false; } static inline bool match_icp_response(uint32_t payload, uint32_t len) { uint32_t stated_len = 0; stated_len = ntohl(payload) & 0xffff; if (stated_len != len) return false; /* Just going to match v2 for now */ /* HIT */ if (MATCH(payload, 0x02, 0x02, ANY, ANY)) return true; /* MISS */ if (MATCH(payload, 0x03, 0x02, ANY, ANY)) return true; /* XXX we possibly could match invalid and error codes as well, * but let's wait until we actually see these things */ return false; } static inline bool match_icp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_icp_query(data->payload[0], data->payload_len[0])) { if (match_icp_response(data->payload[1], data->payload_len[1])) return true; } if (match_icp_query(data->payload[1], data->payload_len[1])) { if (match_icp_response(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_icp = { LPI_PROTO_UDP_ICP, LPI_CATEGORY_CACHING, "ICP", 8, /* Must be run before RADIUS */ match_icp }; void register_icp(LPIModuleMap *mod_map) { register_protocol(&lpi_icp, mod_map); } ================================================ FILE: lib/udp/lpi_imesh.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_imesh_req(uint32_t data, uint32_t len) { if (len != 36 && len != 32) return false; if (MATCH(data, 0x02, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_imesh_resp(uint32_t data, uint32_t len) { if (len == 0) return true; if (len != 36 && len != 32) return false; if (MATCH(data, 0x02, 0x00, ANY, ANY)) return true; return false; } /* XXX Not really sure on this one - based on the code from OpenDPI but I * can't find any documentation that confirms this */ static inline bool match_imesh_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_imesh_req(data->payload[0], data->payload_len[0])) { if (match_imesh_resp(data->payload[1], data->payload_len[1])) return true; } if (match_imesh_req(data->payload[1], data->payload_len[1])) { if (match_imesh_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_imesh_udp = { LPI_PROTO_UDP_IMESH, LPI_CATEGORY_P2P, "iMesh_UDP", 6, match_imesh_udp }; void register_imesh_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_imesh_udp, mod_map); } ================================================ FILE: lib/udp/lpi_ipmsg.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ipmsg(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* IPMSG packet format: * * Version:MessageNumber:User:Host:Command:MsgContent * * Version is always 1. * * All IPMsg observed so far has a message number beginning with * 80... */ /* Do a port check as well, just to be sure */ if (data->server_port != 2425 && data->client_port != 2425) return false; if (match_chars_either(data, '1', ':', '8', '0')) return true; return false; } static lpi_module_t lpi_ipmsg = { LPI_PROTO_UDP_IPMSG, LPI_CATEGORY_CHAT, "IPMsg", 5, match_ipmsg }; void register_ipmsg(LPIModuleMap *mod_map) { register_protocol(&lpi_ipmsg, mod_map); } ================================================ FILE: lib/udp/lpi_ipv6.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ipv6_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->payload_len[0] < 4 && data->payload_len[1] < 4) return false; if (match_str_both(data, "\x60\x00\x00\x00", "\x60\x00\x00\x00")) { return true; } /* One-way DNS check */ if (data->server_port == 53 || data->client_port == 53) return false; if (MATCHSTR(data->payload[0], "\x60\x00\x00\x00")) { if (data->payload_len[1] == 0) { return true; } } if (MATCHSTR(data->payload[1], "\x60\x00\x00\x00")) { if (data->payload_len[0] == 0) { return true; } } return false; } static lpi_module_t lpi_ipv6_udp = { LPI_PROTO_UDP_IPV6, LPI_CATEGORY_TUNNELLING, "UDP_IPv6", 4, match_ipv6_udp }; void register_ipv6_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_ipv6_udp, mod_map); } ================================================ FILE: lib/udp/lpi_isakmp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_isakmp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Rule out anything not on UDP port 500 */ if (data->server_port != 500 && data->client_port != 500) return false; /* Catching one-way ISAKMP is hard, we have to rely on port numbers * because nothing else is consistent :( */ if (data->payload_len[0] == 0 || data->payload_len[1] == 0) { if (data->server_port == 500 && data->client_port == 500) return true; /* Match shadowserver.org scan traffic */ if (MATCH(data->payload[0], 0x3e, 0x35, 0xc7, 0x07)) return true; if (MATCH(data->payload[1], 0x3e, 0x35, 0xc7, 0x07)) return true; return false; } /* First four bytes are the cookie for the initiator, so should match * in both directions */ if (data->payload[0] != data->payload[1]) return false; if (data->payload_len[0] < 4 && data->payload_len[1] < 4) return false; return true; } static lpi_module_t lpi_isakmp = { LPI_PROTO_UDP_ISAKMP, LPI_CATEGORY_KEY_EXCHANGE, "ISAKMP", 6, match_isakmp }; void register_isakmp(LPIModuleMap *mod_map) { register_protocol(&lpi_isakmp, mod_map); } ================================================ FILE: lib/udp/lpi_jedi.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_jedi_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Citrix have a protocol called JEDI which is used for streaming * in products like GoToMyPC */ if (match_str_both(data, "JEDI", "JEDI")) return true; return false; } static lpi_module_t lpi_jedi = { LPI_PROTO_UDP_JEDI, LPI_CATEGORY_REMOTE, "Citrix_Jedi_UDP", 3, match_jedi_udp }; void register_jedi_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_jedi, mod_map); } ================================================ FILE: lib/udp/lpi_jedi_academy.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_jedi_academy(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Pretty rare, but we can write a rule for it */ if (match_str_both(data, "\xff\xff\xff\xff", "\xff\xff\xff\xff")) { /* Server browsing */ if (data->payload_len[0] == 65 && data->payload_len[1] == 181) return true; if (data->payload_len[0] == 66 && data->payload_len[1] == 182) return true; if (data->payload_len[1] == 65 && data->payload_len[0] == 181) return true; if (data->payload_len[1] == 66 && data->payload_len[0] == 182) return true; /* Actual gameplay */ if (data->payload_len[0] == 16 && data->payload_len[1] == 32) return true; if (data->payload_len[1] == 16 && data->payload_len[0] == 32) return true; } return false; } static lpi_module_t lpi_jedi = { LPI_PROTO_UDP_JEDI_ACADEMY, LPI_CATEGORY_GAMING, "JediAcademy", 5, match_jedi_academy }; void register_jedi_academy(LPIModuleMap *mod_map) { register_protocol(&lpi_jedi, mod_map); } ================================================ FILE: lib/udp/lpi_kademlia.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static bool is_kad_e9_payload(uint32_t payload, uint32_t len) { /* This seem to be some variant of Kademlia, although I have not * been able to figure out which */ /* All packets begin with e9, while possible second bytes are * 0x55, 0x56, 0x60, 0x61, 0x76, 0x75 * * 0x56 is a response to 0x55 * 0x61 is a response to 0x60 * 0x76 is a kind of FIN packet, it also responds to 0x75 * * 0x92 seems to be a valid response to unsolicited 0x56 or 0x61 ?? * * There are also packets that seem to begin with 0xea 0x75 0x78 0x9c. */ if (MATCH(payload, 0xe9, 0x55, ANY, ANY) && len == 27) return true; if (MATCH(payload, 0xe9, 0x56, ANY, ANY) && len == 27) return true; if (MATCH(payload, 0xe9, 0x60, ANY, ANY) && len == 34) return true; if (MATCH(payload, 0xe9, 0x61, ANY, ANY)) return true; if (MATCH(payload, 0xe9, 0x76, ANY, ANY) && len == 18) return true; if (MATCH(payload, 0xe9, 0x75, ANY, ANY)) return true; if (MATCH(payload, 0xe9, 0x92, ANY, ANY) && len == 3) return true; if (MATCH(payload, 0xea, 0x75, 0x78, 0x9c)) return true; return false; } static inline bool match_kademlia(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->payload_len[0] == 0 && is_kad_e9_payload(data->payload[1], data->payload_len[1])) return true; if (data->payload_len[1] == 0 && is_kad_e9_payload(data->payload[0], data->payload_len[0])) return true; if (is_kad_e9_payload(data->payload[0], data->payload_len[0]) && is_kad_e9_payload(data->payload[1], data->payload_len[1])) return true; return false; } static lpi_module_t lpi_kademlia = { LPI_PROTO_UDP_KADEMLIA, LPI_CATEGORY_P2P, "Kademlia", 11, match_kademlia }; void register_kademlia(LPIModuleMap *mod_map) { register_protocol(&lpi_kademlia, mod_map); } ================================================ FILE: lib/udp/lpi_kankan.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Kankan -- video streaming by Xunlei */ static inline bool match_kankan(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port == 8080 || data->client_port == 8080) { /* Small flows used probably for DHT-like purposes */ if (data->payload_len[0] == 68 && data->payload_len[1] == 180) return true; if (data->payload_len[0] == 68 && data->payload_len[1] == 0) return true; if (data->payload_len[1] == 68 && data->payload_len[0] == 180) return true; if (data->payload_len[1] == 68 && data->payload_len[0] == 0) return true; } return false; } static lpi_module_t lpi_kankan = { LPI_PROTO_UDP_KANKAN, LPI_CATEGORY_STREAMING, "Kankan", 100, match_kankan }; void register_kankan(LPIModuleMap *mod_map) { register_protocol(&lpi_kankan, mod_map); } ================================================ FILE: lib/udp/lpi_kaspersky.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_kaspersky_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 2001 && data->client_port != 2001) return false; return match_kaspersky(data); } static lpi_module_t lpi_kaspersky = { LPI_PROTO_UDP_KASPERSKY, LPI_CATEGORY_SECURITY, "Kaspersky_UDP", 3, match_kaspersky_udp }; void register_kaspersky_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_kaspersky, mod_map); } ================================================ FILE: lib/udp/lpi_kazaa.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_kazaa(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* 0x27 is a ping, 0x28 and 0x29 are pongs */ /* A Kazaa ping is usually 12 bytes, 0x28 pong is 17, 0x29 pong is 21 */ if (match_str_both(data, "\x27\x00\x00\x00", "\x28\x00\x00\x00")) return true; if (match_str_both(data, "\x27\x00\x00\x00", "\x29\x00\x00\x00")) return true; if (match_str_either(data, "\x27\x00\x00\x00")) { if (data->payload_len[0] == 0 && data->payload_len[1] == 12) return true; if (data->payload_len[1] == 0 && data->payload_len[0] == 12) return true; } return false; } static lpi_module_t lpi_kazaa = { LPI_PROTO_UDP_KAZAA, LPI_CATEGORY_P2P, "Kazaa_UDP", 4, match_kazaa }; void register_kazaa(LPIModuleMap *mod_map) { register_protocol(&lpi_kazaa, mod_map); } ================================================ FILE: lib/udp/lpi_kingofglory_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_kog_44(uint32_t payload, uint32_t len) { if (len == 44 && MATCH(payload, 0x01, 0x02, 0x00, 0x00)) return true; return false; } static inline bool match_kog_24(uint32_t payload, uint32_t len) { if (len == 24) return true; return false; } static inline bool match_kingofglory_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_kog_44(data->payload[0], data->payload_len[0])) { if (match_kog_24(data->payload[1], data->payload_len[1])) return true; } if (match_kog_44(data->payload[1], data->payload_len[1])) { if (match_kog_24(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_kingofglory_udp = { LPI_PROTO_UDP_KINGOFGLORY, LPI_CATEGORY_GAMING, "KingOfGlory_UDP", 101, match_kingofglory_udp }; void register_kingofglory_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_kingofglory_udp, mod_map); } ================================================ FILE: lib/udp/lpi_kuguo.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_kugou_req(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x65, ANY, ANY, ANY)) return true; if (MATCH(payload, 0x64, ANY, ANY, ANY)) return true; return false; } static inline bool match_kugou_resp(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 0x65, ANY, ANY, ANY)) return true; if (MATCH(payload, 0x64, ANY, ANY, ANY)) return true; return false; } static inline bool match_kugou(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Rule is very weak, need to limit to known Kuguo ports */ if (data->server_port != 8000 && data->client_port != 8000) return false; if (match_kugou_req(data->payload[0], data->payload_len[0])) { if (match_kugou_resp(data->payload[1], data->payload_len[1])) return true; } if (match_kugou_req(data->payload[1], data->payload_len[1])) { if (match_kugou_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_kugou = { LPI_PROTO_UDP_KUGOU, LPI_CATEGORY_STREAMING, "Kugou", 200, match_kugou }; void register_kugou(LPIModuleMap *mod_map) { register_protocol(&lpi_kugou, mod_map); } ================================================ FILE: lib/udp/lpi_l2tp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_l2tp_payload(uint32_t payload, uint32_t len) { uint32_t hdrlen = ntohl(payload) & 0xffff; if (len == 0) return true; if (len != hdrlen) return false; if (!MATCH(payload, 0xc8, 0x02, ANY, ANY)) return false; return true; } static inline bool match_l2tp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_l2tp_payload(data->payload[0], data->payload_len[0])) return false; if (!match_l2tp_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_l2tp = { LPI_PROTO_UDP_L2TP, LPI_CATEGORY_TUNNELLING, "L2TP", 6, match_l2tp }; void register_l2tp(LPIModuleMap *mod_map) { register_protocol(&lpi_l2tp, mod_map); } ================================================ FILE: lib/udp/lpi_lansync.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* LANSync is the protocol used by DropBox to sync data changes within the * local network. * * Ref: http://geeklogs.posterous.com/dropbox-lan-sync-protocol */ static inline bool match_lansync_disc(uint32_t payload, uint32_t len) { if (len == 0) return false; if (MATCH(payload, '{', '"', 'h', 'o')) return true; return false; } static inline bool match_lansync_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 17500 && data->client_port != 17500) return false; if (match_lansync_disc(data->payload[0], data->payload_len[0])) { if (data->payload_len[1] == 0) return true; } if (match_lansync_disc(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] == 0) return true; } return false; } static lpi_module_t lpi_lansync_udp = { LPI_PROTO_UDP_LANSYNC, LPI_CATEGORY_BROADCAST, "LanSync_UDP", 6, match_lansync_udp }; void register_lansync_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_lansync_udp, mod_map); } ================================================ FILE: lib/udp/lpi_ldap_ad.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ldap_ad_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 0x30, 0x84, 0x00, 0x00)) return true; return false; } static inline bool match_ldap_ad(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Rule out one-way DNS, which could look like our LDAP AD payload */ if (data->payload_len[0] == 0 || data->payload_len[1] == 0) { if (data->server_port == 53 || data->client_port == 53) return false; } if (!match_ldap_ad_payload(data->payload[0], data->payload_len[0])) return false; if (!match_ldap_ad_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_ldap_ad = { LPI_PROTO_UDP_LDAP_AD, LPI_CATEGORY_SERVICES, "LDAP_AD", 5, match_ldap_ad }; void register_ldap_ad(LPIModuleMap *mod_map) { register_protocol(&lpi_ldap_ad, mod_map); } ================================================ FILE: lib/udp/lpi_line_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_line_108(uint32_t payload, uint32_t len) { if (len != 108) return false; if (MATCH(payload, 0xb6, 0x12, 0x00, 0x68)) return true; return false; } static inline bool match_line_110(uint32_t payload, uint32_t len) { if (len != 110) return false; if (MATCH(payload, 0xb6, 0x18, 0x00, 0x6a)) return true; return false; } static inline bool match_line_35(uint32_t payload, uint32_t len) { if (!MATCH(payload, 0xb6, 0x13, 0x00, 0x06)) return false; if (len == 35 || len == 46) return true; return false; } static inline bool match_line_16(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len == 16 && MATCH(payload, 0xb6, 0x09, 0x00, 0x0c)) return true; return false; } static inline bool match_line_43(uint32_t payload, uint32_t len) { if (len == 43 && MATCH(payload, 0xb6, 0x13, 0x00, 0x27)) return true; if (len == 43 && MATCH(payload, 0xb6, 0x14, 0x00, 0x27)) return true; return false; } static inline bool match_line_46(uint32_t payload, uint32_t len) { if (len == 46 && MATCH(payload, 0xb6, 0x15, 0x00, 0x06)) return true; return false; } static inline bool match_line_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_line_108(data->payload[0], data->payload_len[0])) { if (match_line_35(data->payload[1], data->payload_len[1])) return true; } if (match_line_108(data->payload[1], data->payload_len[1])) { if (match_line_35(data->payload[0], data->payload_len[0])) return true; } if (match_line_110(data->payload[0], data->payload_len[0])) { if (match_line_35(data->payload[1], data->payload_len[1])) return true; } if (match_line_110(data->payload[1], data->payload_len[1])) { if (match_line_35(data->payload[0], data->payload_len[0])) return true; } if (match_line_43(data->payload[0], data->payload_len[0])) { if (match_line_46(data->payload[1], data->payload_len[1])) return true; } if (match_line_43(data->payload[1], data->payload_len[1])) { if (match_line_46(data->payload[0], data->payload_len[0])) return true; } /* Not 100% sure about this one, but the few clues I have make me * think this is likely to be Line. * 1. all connections use at least one port in the 50000+ range. * 2. many remote addresses are in Japanese ASNs. * 3. first byte of payload is 0xb6. */ if (match_line_16(data->payload[0], data->payload_len[0])) { if (match_line_16(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_line_udp = { LPI_PROTO_UDP_LINE, LPI_CATEGORY_CHAT, "Line_UDP", 16, match_line_udp }; void register_line_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_line_udp, mod_map); } ================================================ FILE: lib/udp/lpi_linkproof.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_linkproof(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->payload_len[0] != 0 && data->payload_len[1] != 0) return false; if (!match_str_either(data, "link")) return false; if (data->payload_len[0] == 50 || data->payload_len[1] == 50) return true; return false; } static lpi_module_t lpi_linkproof = { LPI_PROTO_UDP_LINKPROOF, LPI_CATEGORY_MONITORING, "Linkproof", 3, match_linkproof }; void register_linkproof(LPIModuleMap *mod_map) { register_protocol(&lpi_linkproof, mod_map); } ================================================ FILE: lib/udp/lpi_loadout.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_load_42(uint32_t payload, uint32_t len) { if (len == 42 && MATCH(payload, 0x60, 0x0a, 0x00, 0x00)) return true; return false; } static inline bool match_load_46(uint32_t payload, uint32_t len) { if (len == 46 && MATCH(payload, 0x60, 0x0a, 0x00, 0x00)) return true; return false; } static inline bool match_loadout(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_load_42(data->payload[0], data->payload_len[0])) { if (match_load_46(data->payload[1], data->payload_len[1])) return true; } if (match_load_42(data->payload[1], data->payload_len[1])) { if (match_load_46(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_loadout = { LPI_PROTO_UDP_LOADOUT, LPI_CATEGORY_GAMING, "Loadout", 60, match_loadout }; void register_loadout(LPIModuleMap *mod_map) { register_protocol(&lpi_loadout, mod_map); } ================================================ FILE: lib/udp/lpi_lol.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* League of Legends: a popular online game circa 2012/2013 */ static inline bool match_lol(lpi_data_t *data, lpi_module_t *mod UNUSED) { if ((data->server_port < 5100 || data->server_port > 5150) && (data->client_port < 5100 || data->client_port > 5150)) return false; if (data->payload_len[0] == 44 && data->payload_len[1] == 48) return true; if (data->payload_len[1] == 44 && data->payload_len[0] == 48) return true; if (data->payload_len[0] == 52 && data->payload_len[1] == 48) return true; if (data->payload_len[1] == 52 && data->payload_len[0] == 48) return true; return false; } static lpi_module_t lpi_lol = { LPI_PROTO_UDP_LOL, LPI_CATEGORY_GAMING, "LeagueOfLegends", 35, match_lol }; void register_lol(LPIModuleMap *mod_map) { register_protocol(&lpi_lol, mod_map); } ================================================ FILE: lib/udp/lpi_mdns.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Multicast DNS */ static inline bool match_unicast_mdns(lpi_data_t *data) { if (data->server_port != 5353 && data->client_port != 5353) { return false; } /* Only time I've ever seen this is Russian hackers trying * to get more info about the local network. */ if (MATCH(data->payload[0], 0x00, 0x00, 0x84, 0x00)) { if (MATCH(data->payload[1], 0x00, 0x00, 0x00, 0x00)) return true; } if (MATCH(data->payload[1], 0x00, 0x00, 0x84, 0x00)) { if (MATCH(data->payload[0], 0x00, 0x00, 0x00, 0x00)) return true; } return false; } static inline bool match_mdns(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_unicast_mdns(data)) return true; if (data->server_port != 5353) return false; if (data->client_port != 5353) return false; /* Flags are set */ if (MATCH(data->payload[0], 0x00, 0x00, 0x84, 0x00)) { if (data->payload_len[1] == 0) return true; } if (MATCH(data->payload[1], 0x00, 0x00, 0x84, 0x00)) { if (data->payload_len[0] == 0) return true; } /* Flags are not set - this is tricky because the payload is zero */ if (data->payload_len[0] != 0 && data->payload[0] == 0) { if (data->payload_len[1] == 0) return true; } if (data->payload_len[1] != 0 && data->payload[1] == 0) { if (data->payload_len[0] == 0) return true; } return false; } static lpi_module_t lpi_mdns = { LPI_PROTO_UDP_MDNS, LPI_CATEGORY_SERVICES, "mDNS", 20, match_mdns }; void register_mdns(LPIModuleMap *mod_map) { register_protocol(&lpi_mdns, mod_map); } ================================================ FILE: lib/udp/lpi_merakicloud.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_merakicloud(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 7351 */ /* This may just be a user id of some sort -- need to see multiple * users to confirm this is a fixed pattern. */ if (MATCH(data->payload[0], 0xfe, 0xf7, 0x28, 0x91)) { if (MATCH(data->payload[1], 0xfe, 0xf7, 0x28, 0x91)) { return true; } } return false; } static lpi_module_t lpi_merakicloud = { LPI_PROTO_UDP_MERAKICLOUD, LPI_CATEGORY_CLOUD, "MerakiCloud", 34, match_merakicloud }; void register_merakicloud(LPIModuleMap *mod_map) { register_protocol(&lpi_merakicloud, mod_map); } ================================================ FILE: lib/udp/lpi_moh.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_moh_ping(lpi_data_t *data) { /* Seems to be server browsing for Medal of Honor: AA */ if (match_str_both(data, "ping", "\xff\xff\xff\xff")) return true; if (MATCHSTR(data->payload[0], "ping")) { if (data->payload_len[0] != 4) return false; if (data->payload_len[1] == 0) return true; } if (MATCHSTR(data->payload[1], "ping")) { if (data->payload_len[1] != 4) return false; if (data->payload_len[0] == 0) return true; } return false; } static inline bool match_moh(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_moh_ping(data)) return true; if (!MATCH(data->payload[0], 0xff, 0xff, 0xff, 0xff)) return false; if (!MATCH(data->payload[1], 0xff, 0xff, 0xff, 0xff)) return false; /* This is kinda a broad match, so let's refine it a bit by using the * port number */ if (data->server_port >= 12200 && data->server_port <= 12210) { if (data->payload_len[0] == 16 && data->payload_len[1] > 600) return true; if (data->payload_len[1] == 16 && data->payload_len[0] > 600) return true; } if (data->client_port >= 12200 && data->client_port <= 12210) { if (data->payload_len[0] == 16 && data->payload_len[1] > 600) return true; if (data->payload_len[1] == 16 && data->payload_len[0] > 600) return true; } return false; } static lpi_module_t lpi_moh = { LPI_PROTO_UDP_MOH, LPI_CATEGORY_GAMING, "MedalOfHonor", 8, match_moh }; void register_moh(LPIModuleMap *mod_map) { register_protocol(&lpi_moh, mod_map); } ================================================ FILE: lib/udp/lpi_moonhunters.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Needs to be confirmed, as this game costs money, but pretty confident * that Moon Hunters is the source of the traffic for this rule. */ static inline bool match_mh_27(uint32_t payload, uint32_t len) { if (len == 27 && MATCH(payload, 0x00, 0x00, 0x05, 0x00)) return true; return false; } static inline bool match_mh_10(uint32_t payload, uint32_t len) { if (len == 10 && MATCH(payload, 0x00, 0x00, 0x05, 0x00)) return true; return false; } static inline bool match_moonhunters(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 9999 && data->client_port != 9999) return false; if (match_mh_27(data->payload[0], data->payload_len[0])) { if (match_mh_10(data->payload[1], data->payload_len[1])) return true; } if (match_mh_27(data->payload[1], data->payload_len[1])) { if (match_mh_10(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_moonhunters = { LPI_PROTO_UDP_MOONHUNTERS, LPI_CATEGORY_GAMING, "MoonHunters", 51, match_moonhunters }; void register_moonhunters(LPIModuleMap *mod_map) { register_protocol(&lpi_moonhunters, mod_map); } ================================================ FILE: lib/udp/lpi_mp2p.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mp2p_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* At least one of the endpoints needs to be on the known port */ if (data->server_port != 41170 && data->client_port != 41170) return false; if (match_chars_either(data, 0x3d, 0x4a, 0xd9, ANY)) return true; if (match_chars_either(data, 0x3e, 0x4a, 0xd9, ANY)) return true; if (match_chars_either(data, 0x3d, 0x4b, 0xd9, ANY)) return true; if (match_chars_either(data, 0x3e, 0x4b, 0xd9, ANY)) return true; if (match_chars_either(data, ANY, 0x4b, 0xd9, 0x65)) return true; if (match_chars_either(data, ANY, 0x4a, 0xd9, 0x65)) return true; if (match_chars_either(data, ANY, 0x4a, 0xd6, 0x6f)) return true; if (match_chars_either(data, ANY, 0x4a, 0xd6, 0x90)) return true; /* Seeing a lot of these in flows using port 41170 both ways */ /* Watch out for one-way DNS again */ if (data->server_port == 53 || data->client_port == 53) return false; if (MATCH(data->payload[0], ANY, ANY, 0x00, 0x00) && data->payload_len[0] != 0) { if (data->payload_len[1] != 0) return false; return true; } if (MATCH(data->payload[1], ANY, ANY, 0x00, 0x00) && data->payload_len[1] != 0) { if (data->payload_len[0] != 0) return false; return true; } return false; } static lpi_module_t lpi_mp2p_udp = { LPI_PROTO_UDP_MP2P, LPI_CATEGORY_P2P, "MP2P_UDP", 4, match_mp2p_udp }; void register_mp2p_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_mp2p_udp, mod_map); } ================================================ FILE: lib/udp/lpi_msn_cache.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_msn_cache(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->payload_len[0] != 0 && data->payload_len[1] != 0) return false; /* These packets seem to be 20 bytes */ if (data->payload_len[0] != 20 && data->payload_len[1] != 20) return false; if (match_chars_either(data, 0x02, 0x04, 0x00, 0x00)) return true; if (match_chars_either(data, 0x02, 0x01, 0x41, 0x31)) return true; return false; } static lpi_module_t lpi_msn_cache = { LPI_PROTO_UDP_MSN_CACHE, LPI_CATEGORY_CHAT, "MSN_Cache", 3, match_msn_cache }; void register_msn_cache(LPIModuleMap *mod_map) { register_protocol(&lpi_msn_cache, mod_map); } ================================================ FILE: lib/udp/lpi_msn_video.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_msn_video(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* The authorization messages use a code of 0x48, followed by 3 * bytes of zero. The packet contains no non-header payload, so the * payload length must be the size of the MSN video header (10 bytes) * * Ref: http://ml20rc.msnfanatic.com/vc_1_1/index.html */ if (!(MATCHSTR(data->payload[0], "\x48\x00\x00\x00") && data->payload_len[0] == 10)) return false; if (!(MATCHSTR(data->payload[1], "\x48\x00\x00\x00") && data->payload_len[1] == 10)) return false; return true; } static lpi_module_t lpi_msn_video = { LPI_PROTO_UDP_MSN_VIDEO, LPI_CATEGORY_CHAT, "MSN_Video_UDP", 3, match_msn_video }; void register_msn_video(LPIModuleMap *mod_map) { register_protocol(&lpi_msn_video, mod_map); } ================================================ FILE: lib/udp/lpi_msoffice_mac.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Protocol used by MS Office 2008 (Mac OS X version only) for license checking * on a local network. */ static inline bool match_office_2008(lpi_data_t *data) { if (!match_str_either(data, "MSOP")) return false; if (data->payload_len[0] == 72 && data->payload_len[1] == 0) return true; if (data->payload_len[1] == 72 && data->payload_len[0] == 0) return true; return false; } static inline bool match_msoffice_mac(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port == 2223 || data->client_port == 2223) { return match_office_2008(data); } return false; } static lpi_module_t lpi_msoffice_mac = { LPI_PROTO_UDP_MSOFFICE_MAC, LPI_CATEGORY_BROADCAST, "MSOffice_Mac", 10, match_msoffice_mac }; void register_msoffice_mac(LPIModuleMap *mod_map) { register_protocol(&lpi_msoffice_mac, mod_map); } ================================================ FILE: lib/udp/lpi_mta.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ase_ping(lpi_data_t *data) { /* Commonly used by MultiTheftAuto - the use of "ping" and * "Ping" is not documented though */ if (MATCHSTR(data->payload[0], "ping")) { if (data->payload_len[0] != 16) return false; if (data->payload_len[1] == 0) return true; if (data->payload_len[1] != 16) return false; if (MATCHSTR(data->payload[1], "Ping")) return true; return false; } if (MATCHSTR(data->payload[1], "ping")) { if (data->payload_len[1] != 16) return false; if (data->payload_len[0] == 0) return true; if (data->payload_len[0] != 16) return false; if (MATCHSTR(data->payload[0], "Ping")) return true; return false; } return false; } static inline bool match_mta(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Multitheftauto uses ASE on UDP to ping servers */ if (match_ase_ping(data)) return true; return false; } static lpi_module_t lpi_mta = { LPI_PROTO_UDP_MTA, LPI_CATEGORY_GAMING, "MultiTheftAuto", 5, match_mta }; void register_mta(LPIModuleMap *mod_map) { register_protocol(&lpi_mta, mod_map); } ================================================ FILE: lib/udp/lpi_mystery_02_36.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mystery_02_36(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Another mystery protocol :/ * * Characterised by 36 byte datagrams in both directions, always * beginning with 02 00 XX 00. * * Later packets also begin with 02 and have 00 in the fourth byte. * Packet size varies. */ if (MATCH(data->payload[0], 0x02, 0x00, ANY, ANY) && data->payload_len[0] == 36) { if (data->payload_len[1] == 0) return true; if (MATCH(data->payload[1], 0x02, 0x00, ANY, ANY) && data->payload_len[1] == 36) return true; } if (MATCH(data->payload[1], 0x02, 0x00, ANY, ANY) && data->payload_len[1] == 36) { if (data->payload_len[0] == 0) return true; if (MATCH(data->payload[0], 0x02, 0x00, ANY, ANY) && data->payload_len[0] == 36) return true; } return false; } static lpi_module_t lpi_mystery_02_36 = { LPI_PROTO_UDP_MYSTERY_02_36, LPI_CATEGORY_NO_CATEGORY, "Mystery_02_36", 250, match_mystery_02_36 }; void register_mystery_02_36(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_02_36, mod_map); } ================================================ FILE: lib/udp/lpi_mystery_05.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_05_ffff(uint32_t payload, uint32_t len) { if (len != 6) return false; if (MATCHSTR(payload, "\x05\x03\xff\xff")) return true; return false; } static inline bool match_05_reply(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len != 8) return false; if (MATCH(payload, 0x05, 0x00, 0x00, ANY)) return true; return false; } static inline bool match_mystery_05(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* No idea what this stuff is, but it accounts for a lot of flows * and a lot of bytes. Lots of Malaysian remote hosts? */ if (match_05_ffff(data->payload[0], data->payload_len[0])) { if (match_05_ffff(data->payload[1], data->payload_len[1])) return true; if (match_05_reply(data->payload[1], data->payload_len[1])) return true; } if (match_05_ffff(data->payload[1], data->payload_len[1])) { if (match_05_ffff(data->payload[0], data->payload_len[0])) return true; if (match_05_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_mystery_05 = { LPI_PROTO_UDP_MYSTERY_05, LPI_CATEGORY_NO_CATEGORY, "Mystery_05", 250, match_mystery_05 }; void register_mystery_05(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_05, mod_map); } ================================================ FILE: lib/udp/lpi_mystery_0660.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mystery_0660(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->payload_len[0] != 0 && data->payload_len[0] != 15) return false; if (data->payload_len[1] != 0 && data->payload_len[1] != 15) return false; if (MATCH(data->payload[0], 0x06, 0x60, 0x00, 0x00)) { if (data->payload_len[1] == 0) return true; if (MATCH(data->payload[1], 0x06, 0x60, 0x00, 0x00)) return true; return false; } if (MATCH(data->payload[1], 0x06, 0x60, 0x00, 0x00)) { if (data->payload_len[0] == 0) return true; if (MATCH(data->payload[0], 0x06, 0x60, 0x00, 0x00)) return true; return false; } return false; } static lpi_module_t lpi_mystery_0660 = { LPI_PROTO_UDP_MYSTERY_0660, LPI_CATEGORY_NO_CATEGORY, "Mystery_0660", 250, match_mystery_0660 }; void register_mystery_0660(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_0660, mod_map); } ================================================ FILE: lib/udp/lpi_mystery_0d.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mystery_0d(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This protocol has driven me nuts for weeks. It's pretty easy to * match - one direction sends a single byte datagram containing 0x0d, * the other responds with a 25 byte packet beginning with 0x0a. The * next three bytes of the response appear to be some sort of flow id * that is repeated in all subsequent packets > 1 byte. * * Other codes used during the exchange are 0x0b, 0x15 and 0x1e. * * However, there appears to be no info on the Internet about what this * protocol is. Random ports are always used for both ends, so no help * there. * * TODO Figure out what the hell this is and give it a better name * than "mystery_0d" ! */ if (data->payload_len[0]==1 && MATCH(data->payload[0], 0x0d, 0, 0, 0)) { if (data->payload_len[1] == 25 && MATCH(data->payload[1], 0x0a, ANY, ANY, ANY)) return true; if (data->payload_len[1] == 0) return true; } if (data->payload_len[1]==1 && MATCH(data->payload[1], 0x0d, 0, 0, 0)) { if (data->payload_len[0] == 25 && MATCH(data->payload[0], 0x0a, ANY, ANY, ANY)) return true; if (data->payload_len[0] == 0) return true; } /* We also see the 25 byte 0x0a packet without a matching 0x0d packet */ if (data->payload_len[0] == 0) { if (data->payload_len[1] == 25 && MATCH(data->payload[1], 0x0a, ANY, ANY, ANY)) return true; } if (data->payload_len[1] == 0) { if (data->payload_len[0] == 25 && MATCH(data->payload[0], 0x0a, ANY, ANY, ANY)) return true; } return false; } static lpi_module_t lpi_mystery_0d = { LPI_PROTO_UDP_MYSTERY_0D, LPI_CATEGORY_NO_CATEGORY, "Mystery_0D", 250, match_mystery_0d }; void register_mystery_0d(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_0d, mod_map); } ================================================ FILE: lib/udp/lpi_mystery_45.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mystery_45(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->payload_len[0] != 0 && data->payload_len[0] != 33 && data->payload_len[0] != 69) return false; if (data->payload_len[1] != 0 && data->payload_len[1] != 33 && data->payload_len[1] != 69) return false; if (MATCH(data->payload[0], 0x00, 0x00, 0x00, 0x45)) { if (data->payload_len[1] == 0) return true; if (!MATCH(data->payload[1], 0x00, 0x00, 0x00, 0x45)) return false; if (data->payload_len[0] == 33 && data->payload_len[1] == 69) return true; if (data->payload_len[1] == 33 && data->payload_len[0] == 69) return true; return false; } if (MATCH(data->payload[1], 0x00, 0x00, 0x00, 0x45)) { if (data->payload_len[0] == 0) return true; if (!MATCH(data->payload[0], 0x00, 0x00, 0x00, 0x45)) return false; if (data->payload_len[0] == 33 && data->payload_len[1] == 69) return true; if (data->payload_len[1] == 33 && data->payload_len[0] == 69) return true; return false; } return false; } static lpi_module_t lpi_mystery_45 = { LPI_PROTO_UDP_MYSTERY_45, LPI_CATEGORY_NO_CATEGORY, "Mystery_45", 250, match_mystery_45 }; void register_mystery_45(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_45, mod_map); } ================================================ FILE: lib/udp/lpi_mystery_61_72.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mystery_61_72(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Not sure what this is, but there are a lot of these flows in my * unknown NAT hole data */ if (data->payload[0] != data->payload[1]) return false; if (data->payload[0] == 0 || data->payload[1] == 0) return false; if (data->payload_len[0] == 61 && data->payload_len[1] == 72) return true; if (data->payload_len[0] == 72 && data->payload_len[1] == 61) return true; return false; } static lpi_module_t lpi_mystery_61_72 = { LPI_PROTO_UDP_MYSTERY_61_72, LPI_CATEGORY_NO_CATEGORY, "Mystery_UDP_61_72", 250, match_mystery_61_72 }; void register_mystery_61_72(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_61_72, mod_map); } ================================================ FILE: lib/udp/lpi_mystery_8000.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mystery_8000_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* These patterns typically appear on UDP port 8000 (and occasionally * TCP port 80) */ if (!match_8000_payload(data->payload[0], data->payload_len[0])) return false; if (!match_8000_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_mystery_8000_udp = { LPI_PROTO_UDP_MYSTERY_8000, LPI_CATEGORY_NO_CATEGORY, "Mystery_8000_UDP", 250, match_mystery_8000_udp }; void register_mystery_8000_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_8000_udp, mod_map); } ================================================ FILE: lib/udp/lpi_mystery_99.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mystery_99(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Another mystery protocol - this one is possibly something to do * with bittorrent, as I've seen it on port 6881 from time to time */ /* Both payloads must match */ if (data->payload[0] != data->payload[1]) return false; /* One of the payloads is 99 bytes, the other is between 168 and 173 * bytes */ if (data->payload_len[0] == 99) { if (data->payload_len[1] >= 168 && data->payload_len[1] <= 173) return true; } if (data->payload_len[1] == 99) { if (data->payload_len[0] >= 168 && data->payload_len[0] <= 173) return true; } return false; } static lpi_module_t lpi_mystery_99 = { LPI_PROTO_UDP_MYSTERY_99, LPI_CATEGORY_NO_CATEGORY, "Mystery_99", 250, match_mystery_99 }; void register_mystery_99(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_99, mod_map); } ================================================ FILE: lib/udp/lpi_mystery_bt_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* This appears to be associated with BitTorrent somehow - there are occasional * DHT-style bencoding dictionaries in these flows, but cannot find anything * to confirm this :/ */ static inline bool payload_check(uint32_t a, uint32_t b) { /* In most cases, the last two bytes must match but I've also seen * instances where one of the bytes is one greater than the other * * No idea what is actually going on though :/ */ if (a == b) return true; if (a - 1 == b) return true; if (a + 1 == b) return true; return false; } static inline bool match_2102_response(uint32_t payload, uint32_t other, uint32_t len) { if (len == 0) return true; if (!payload_check(htonl(payload) & 0x0000ffff, htonl(other) & 0x0000ffff)) return false; if (MATCH(payload, 0x21, 0x02, ANY, ANY) && len == 30) return true; if (MATCH(payload, 0x21, 0x00, ANY, ANY) && len == 20) return true; if (MATCH(payload, 0x21, 0x01, ANY, ANY) && len == 26) return true; return false; } static inline bool match_3102_response(uint32_t payload, uint32_t other, uint32_t len) { if (len == 0) return true; if (len != 30 && len != 20) return false; if (!payload_check(htonl(payload) & 0x0000ffff, htonl(other) & 0x0000ffff)) return false; if (MATCH(payload, 0x31, 0x02, ANY, ANY) && len == 30) return true; if (MATCH(payload, 0x31, 0x00, ANY, ANY) && len == 20) return true; return false; } static inline bool match_4102_response(uint32_t payload, uint32_t other, uint32_t len) { if (len == 0) return true; if (len != 33) return false; if (!payload_check(htonl(payload) & 0x0000ffff, htonl(other) & 0x0000ffff)) return false; if (!MATCH(payload, 0x41, 0x02, ANY, ANY)) return false; return true; } static inline bool match_dict(uint32_t payload, uint32_t len) { /* Check for bencoded dictionary */ if (MATCH(payload, 'd', '1', ':', 'r')) return true; if (MATCH(payload, 'd', '1', ':', 'a')) return true; if (MATCH(payload, 'd', '1', ':', 'e')) return true; if (MATCH(payload, 'd', '1', ANY, ':')) return true; return false; } static inline bool match_0100_request(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x01, 0x00, ANY, ANY) && len > 500) return true; return false; } static inline bool match_2102_request(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x21, 0x02, ANY, ANY) && len == 30) return true; if (MATCH(payload, 0x21, 0x00, ANY, ANY) && len == 20) return true; if (MATCH(payload, 0x21, 0x01, ANY, ANY) && len == 26) return true; return false; } static inline bool match_3102_request(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x31, 0x02, ANY, ANY) && len == 30) return true; if (MATCH(payload, 0x31, 0x00, ANY, ANY) && len == 20) return true; return false; } static inline bool match_4102_request(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x41, 0x02, ANY, ANY) && len == 30) return true; if (MATCH(payload, 0x41, 0x00, ANY, ANY) && len == 20) return true; return false; } static inline bool match_mystery_bt_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_4102_request(data->payload[0], data->payload_len[0])) { if (match_2102_response(data->payload[1], data->payload[0], data->payload_len[1])) return true; if (match_4102_response(data->payload[1], data->payload[0], data->payload_len[1])) return true; if (match_dict(data->payload[1], data->payload_len[1])) return true; } if (match_4102_request(data->payload[1], data->payload_len[1])) { if (match_2102_response(data->payload[0], data->payload[1], data->payload_len[0])) return true; if (match_4102_response(data->payload[0], data->payload[1], data->payload_len[0])) return true; if (match_dict(data->payload[0], data->payload_len[0])) return true; } if (match_2102_request(data->payload[0], data->payload_len[0])) { if (match_3102_response(data->payload[1], data->payload[0], data->payload_len[1])) return true; } if (match_2102_request(data->payload[1], data->payload_len[1])) { if (match_3102_response(data->payload[0], data->payload[1], data->payload_len[0])) return true; } if (match_0100_request(data->payload[0], data->payload_len[0])) { if (match_3102_response(data->payload[1], data->payload[0], data->payload_len[1])) return true; if (match_2102_response(data->payload[1], data->payload[0], data->payload_len[1])) return true; } if (match_0100_request(data->payload[1], data->payload_len[1])) { if (match_3102_response(data->payload[0], data->payload[1], data->payload_len[0])) return true; if (match_2102_response(data->payload[0], data->payload[1], data->payload_len[0])) return true; } if (match_3102_request(data->payload[0], data->payload_len[0])) { if (data->payload_len[1] == 0) return true; } if (match_3102_request(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] == 0) return true; } if (match_dict(data->payload[0], data->payload_len[0])) { if (match_2102_response(data->payload[1], data->payload[0], data->payload_len[1])) return true; } if (match_dict(data->payload[1], data->payload_len[1])) { if (match_2102_response(data->payload[0], data->payload[1], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_mystery_bt_udp= { LPI_PROTO_UDP_MYSTERY_BT, LPI_CATEGORY_P2P, "Mystery_BitTorrent_UDP", 9, /* Need to be higher than Skype or Gnutella */ match_mystery_bt_udp }; void register_mystery_bt_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_bt_udp, mod_map); } ================================================ FILE: lib/udp/lpi_mystery_e9.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_e9_payload(uint32_t payload, uint32_t len) { if (MATCH(payload, 0xe9, 0x82, ANY, ANY)) { if (len == 58) return true; if (len == 28) return true; } if (MATCH(payload, 0xe9, 0x83, ANY, ANY)) { if (len == 23) return true; if (len == 28) return true; if (len == 46) return true; } if (MATCH(payload, 0xe9, 0x60, ANY, ANY)) { if (len == 34) return true; } return false; } static inline bool match_mystery_e9(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->payload_len[1] == 0) { if (match_e9_payload(data->payload[0], data->payload_len[0])) return true; } if (data->payload_len[0] == 0) { if (match_e9_payload(data->payload[1], data->payload_len[1])) return true; } /* Bytes 3 and 4 of payload should match */ if ((data->payload[0] & 0xffff0000) != (data->payload[1] & 0xffff0000)) return false; if (!match_e9_payload(data->payload[0], data->payload_len[0])) return false; if (!match_e9_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_mystery_e9 = { LPI_PROTO_UDP_MYSTERY_E9, LPI_CATEGORY_NO_CATEGORY, "Mystery_E9", 250, match_mystery_e9 }; void register_mystery_e9(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_e9, mod_map); } ================================================ FILE: lib/udp/lpi_mystery_emule.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_mystery_emule(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* These particular patterns occur frequently on port 4672, making * me think they're some sort of emule traffic but there is no * obvious documentation. The payloads appear to be random, which * is unlike all other emule traffic. The flows tend to consist of * only one or two packets in each direction. */ if (data->payload_len[0] == 44 && data->payload_len[1] >= 38 && data->payload_len[1] <= 50) return true; if (data->payload_len[1] == 44 && data->payload_len[0] >= 38 && data->payload_len[0] <= 50) return true; if (data->payload_len[0] == 51 && (data->payload_len[1] == 135 || data->payload_len[1] == 85 || data->payload_len[1] == 310)) return true; if (data->payload_len[1] == 51 && (data->payload_len[0] == 135 || data->payload_len[0] == 85 || data->payload_len[0] == 310)) return true; return false; } static lpi_module_t lpi_mystery_emule = { LPI_PROTO_UDP_EMULE_MYSTERY, LPI_CATEGORY_P2P, "eMule_UDP_Mystery", 250, match_mystery_emule }; void register_mystery_emule(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_emule, mod_map); } ================================================ FILE: lib/udp/lpi_mystery_qq.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_qq_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len != 24) return false; if (MATCH(payload, 0x51, 0x51, 0x05, 0x00)) return true; return false; } static inline bool match_mystery_qq(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Not to be confused with Tencent QQ. * * This is almost certainly a gaming protocol related to the * PlayStation (based on port number). */ if (data->server_port != 3658 && data->client_port != 3658) return false; if (match_qq_payload(data->payload[0], data->payload_len[0])) { if (match_qq_payload(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_mystery_qq = { LPI_PROTO_UDP_MYSTERY_QQ, LPI_CATEGORY_NO_CATEGORY, "Mystery_QQ", 2, match_mystery_qq }; void register_mystery_qq(LPIModuleMap *mod_map) { register_protocol(&lpi_mystery_qq, mod_map); } ================================================ FILE: lib/udp/lpi_n2ping.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* This is a horrible pseudo-VPN that is used to access content that is * restricted to China only. Despite their claims, the traffic is not * encrypted -- just tunnelled over a custom UDP application protocol * to a server in Hong Kong. */ static inline bool match_n2ping_header(uint32_t payload) { if (MATCH(payload, 0x08, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_n2ping(lpi_data_t *data, lpi_module_t *mod UNUSED) { bool validport = false; if (data->server_port == 44778 || data->client_port == 44778) { validport = true; } if (data->server_port == 23 || data->client_port == 23) { validport = true; } if (validport && match_n2ping_header(data->payload[0]) && match_n2ping_header(data->payload[1])) { if (data->payload_len[0] < 100) return true; if (data->payload_len[1] < 100) return true; } return false; } static lpi_module_t lpi_n2ping = { LPI_PROTO_UDP_N2PING, LPI_CATEGORY_TUNNELLING, "N2Ping", 150, match_n2ping }; void register_n2ping(LPIModuleMap *mod_map) { register_protocol(&lpi_n2ping, mod_map); } ================================================ FILE: lib/udp/lpi_natpmp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_natpmp_probe(uint32_t payload, uint32_t len) { if (len != 2) return false; if (!MATCHSTR(payload, "\x00\x00\x00\x00")) return false; return true; } static inline bool match_natpmp_response(uint32_t payload, uint32_t len) { if (len == 0) return true; /* Just guessing based on RFC6886 */ if (len != 12) return false; if (!MATCHSTR(payload, "\x00\x80\x00\x00")) return false; return true; } static inline bool match_natpmp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* XXX Shall we limit to port 5351 only? */ /* Only seen attempted scanning so far */ if (match_natpmp_probe(data->payload[0], data->payload_len[0])) { if (match_natpmp_response(data->payload[1], data->payload_len[1])) return true; } if (match_natpmp_probe(data->payload[1], data->payload_len[1])) { if (match_natpmp_response(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_natpmp = { LPI_PROTO_UDP_NATPMP, LPI_CATEGORY_NAT, "NAT-PMP", 20, match_natpmp }; void register_natpmp(LPIModuleMap *mod_map) { register_protocol(&lpi_natpmp, mod_map); } ================================================ FILE: lib/udp/lpi_netbios.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_netbios_name_req(uint32_t payload, uint32_t len) { if (MATCH(payload, ANY, ANY, 0x00, 0x00)) { if (len == 50) return true; if (len == 20) return true; if (len == 33) return true; } if (MATCH(payload, ANY, ANY, 0x01, 0x00)) { if (len == 50) return true; } if (MATCH(payload, ANY, ANY, 0x40, 0x00)) { if (len == 68) return true; } if (MATCH(payload, ANY, ANY, 0x29, 0x10)) { if (len == 68) return true; } /* Broadcast traffic */ if (MATCH(payload, ANY, ANY, 0x01, 0x10)) { if (len == 50) return true; } return false; } static inline bool match_netbios_name_resp(uint32_t resp, uint32_t req) { if (!MATCH(resp, ANY, ANY, 0x84, 0x00)) return false; /* First two bytes must match */ if ((resp & 0x0000ffff) != (req & 0x0000ffff)) return false; return true; } static inline bool match_netbios_datagram(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x11, 0x02, ANY, ANY)) return true; if (MATCH(payload, 0x11, 0x06, ANY, ANY)) return true; if (MATCH(payload, 0x11, 0x0e, ANY, ANY)) return true; return false; } static inline bool match_name_resp_only(lpi_data_t *data) { /* Match the "special" case where only a name response is * observed, presumably misdirected traffic */ if (data->payload_len[0] != 0 && data->payload_len[1] != 0) return false; if (data->server_port != 137 && data->client_port != 137) return false; if (!match_chars_either(data, ANY, ANY, 0x84, 0x00)) return false; return true; } static inline bool match_netbios_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_netbios_name_req(data->payload[0], data->payload_len[0])) { if (data->server_port != 137 && data->client_port != 137) return false; if (match_netbios_name_resp(data->payload[1], data->payload[0])) return true; if (data->payload_len[1] == 0) return true; } if (match_netbios_name_req(data->payload[1], data->payload_len[1])) { if (data->server_port != 137 && data->client_port != 137) return false; if (match_netbios_name_resp(data->payload[0], data->payload[1])) return true; if (data->payload_len[0] == 0) return true; } if (match_netbios_datagram(data->payload[0], data->payload_len[0])) { if (data->server_port != 138 && data->client_port != 138) return false; if (data->payload_len[1] == 0) return true; } if (match_netbios_datagram(data->payload[1], data->payload_len[1])) { if (data->server_port != 138 && data->client_port != 138) return false; if (data->payload_len[0] == 0) return true; } if (match_name_resp_only(data)) return true; return false; } static lpi_module_t lpi_netbios_udp = { LPI_PROTO_UDP_NETBIOS, LPI_CATEGORY_SERVICES, "NetBIOS_UDP", 5, match_netbios_udp }; void register_netbios_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_netbios_udp, mod_map); } ================================================ FILE: lib/udp/lpi_netcat_cctv_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_xmip_header(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x12, 0x20, 0xd0, 0x07)) { if (len == 112 || len == 120 || len == 184 || len == 148) return true; } return false; } static inline bool match_netcat_cctv_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_xmip_header(data->payload[0], data->payload_len[0])) { if (match_xmip_header(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_netcat_cctv_udp = { LPI_PROTO_UDP_NETCAT_CCTV, LPI_CATEGORY_IPCAMERAS, "NetcatCCTV_UDP", 22, match_netcat_cctv_udp }; void register_netcat_cctv_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_netcat_cctv_udp, mod_map); } ================================================ FILE: lib/udp/lpi_netcore_scan.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_netcore_scan(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Well-known vulnerability in Netcore CPEs, which listen on port * 53413 on the WAN interface. * * Mostly just a major source of UDP scan traffic. */ if (data->server_port != 53413 && data->client_port != 53413) return false; if (MATCHSTR(data->payload[0], "AAAA")) return true; if (MATCHSTR(data->payload[1], "AAAA")) return true; if (MATCHSTR(data->payload[0], "AA\x00\x00")) return true; if (MATCHSTR(data->payload[1], "AA\x00\x00")) return true; return false; } static lpi_module_t lpi_netcore_scan = { LPI_PROTO_UDP_NETCORE, LPI_CATEGORY_MALWARE, "NetcoreScan", 199, match_netcore_scan }; void register_netcore_scan(LPIModuleMap *mod_map) { register_protocol(&lpi_netcore_scan, mod_map); } ================================================ FILE: lib/udp/lpi_netflow.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_netflow(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* NetFlow is one-way only */ if (data->payload_len[0] != 0 && data->payload_len[1] != 0) return false; /* Force port requirement for now */ if (data->server_port != 9996 && data->client_port != 9996) return false; /* Match NetFlow version 5 */ if (MATCH(data->payload[0], 0x00, 0x05, 0x00, ANY)) return true; if (MATCH(data->payload[1], 0x00, 0x05, 0x00, ANY)) return true; /* Match NetFlow version 9 */ if (MATCH(data->payload[0], 0x00, 0x09, 0x00, ANY)) return true; if (MATCH(data->payload[1], 0x00, 0x09, 0x00, ANY)) return true; return false; } static lpi_module_t lpi_netflow = { LPI_PROTO_UDP_NETFLOW, LPI_CATEGORY_MONITORING, "NetFlow", 14, match_netflow }; void register_netflow(LPIModuleMap *mod_map) { register_protocol(&lpi_netflow, mod_map); } ================================================ FILE: lib/udp/lpi_newerth.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_newerth_301(uint32_t payload, uint32_t len) { if (len == 27 && MATCH(payload, 0x00, 0x00, 0x03, 0x01)) return true; return false; } static inline bool match_newerth_1c9(uint32_t payload, uint32_t len) { if (len == 4 && MATCH(payload, 0x00, 0x00, 0x01, 0xc9)) return true; return false; } static inline bool match_newerth_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 0x00, 0x00, 0x01, 0x66)) return true; if (MATCH(payload, 0x00, 0x00, 0x01, 0xca) && len == 6) return true; return false; } static inline bool match_newerth(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_newerth_1c9(data->payload[0], data->payload_len[0])) { if (match_newerth_301(data->payload[1], data->payload_len[1])) return true; } if (match_newerth_1c9(data->payload[1], data->payload_len[1])) { if (match_newerth_301(data->payload[0], data->payload_len[0])) return true; } if (!match_newerth_payload(data->payload[0], data->payload_len[0])) return false; if (!match_newerth_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_newerth = { LPI_PROTO_UDP_NEWERTH, LPI_CATEGORY_GAMING, "NewerthGames", 3, match_newerth }; void register_newerth(LPIModuleMap *mod_map) { register_protocol(&lpi_newerth, mod_map); } ================================================ FILE: lib/udp/lpi_nintendo.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_nintendo_magic(uint32_t payload, uint32_t len) { /* https://github.com/Shragei/SplatNet/blob/master/NinMainTiming.txt */ if ((len == 64 || len == 84) && MATCH(payload, 0x32, 0xab, 0x98, 0x64)) return true; return false; } static inline bool match_nintendo(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_nintendo_magic(data->payload[0], data->payload_len[0])) { if (match_nintendo_magic(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_nintendo = { LPI_PROTO_UDP_NINTENDO, LPI_CATEGORY_GAMING, "NintendoGames", 5, match_nintendo }; void register_nintendo(LPIModuleMap *mod_map) { register_protocol(&lpi_nintendo, mod_map); } ================================================ FILE: lib/udp/lpi_noction.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_noction(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Never seen anyone reply to this stuff */ if (match_str_either(data, "NOCT")) return true; return false; } static lpi_module_t lpi_noction = { LPI_PROTO_UDP_NOCTION, LPI_CATEGORY_MONITORING, "NoctionIRP", 3, match_noction }; void register_noction(LPIModuleMap *mod_map) { register_protocol(&lpi_noction, mod_map); } ================================================ FILE: lib/udp/lpi_noe.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Alcatel's New Office Environment proprietary VOIP protocol * Thanks to Remy Mudingay for providing traces to identify this protocol */ static inline bool match_noe_5byte(uint32_t payload, uint32_t plen) { if (plen != 5) return false; if (MATCH(payload, 0x07, ANY, ANY, ANY)) return true; return false; } static inline bool match_noe_20byte(uint32_t payload, uint32_t plen) { if (plen != 20) return false; if (MATCH(payload, 0x07, ANY, ANY, ANY)) return true; return false; } static inline bool match_noe(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->payload_len[0] == 1 && data->payload_len[1] == 1) { if (match_str_both(data, "\x05\x00\x00\x00", "\x04\x00\x00\x00")) { return true; } } if (match_noe_5byte(data->payload[0], data->payload_len[0])) { if (match_noe_20byte(data->payload[1], data->payload_len[1])) return true; } if (match_noe_5byte(data->payload[1], data->payload_len[1])) { if (match_noe_20byte(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_noe = { LPI_PROTO_UDP_NOE, LPI_CATEGORY_VOIP, "NOE", 12, match_noe }; void register_noe(LPIModuleMap *mod_map) { register_protocol(&lpi_noe, mod_map); } ================================================ FILE: lib/udp/lpi_nopayload.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_udp_no_payload(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->observed[0] == 0 && data->observed[1] == 0) return true; return false; } static lpi_module_t lpi_udp_no_payload = { LPI_PROTO_NO_PAYLOAD, LPI_CATEGORY_NOPAYLOAD, "No_Payload", 0, /* Must be highest priority! */ match_udp_no_payload }; void register_udp_no_payload(LPIModuleMap *mod_map) { register_protocol(&lpi_udp_no_payload, mod_map); } ================================================ FILE: lib/udp/lpi_norton.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_norton_24_00(uint32_t payload, uint32_t len) { if (len != 24) return false; if (MATCH(payload, 0x00, 0x10, 0x00, 0x14)) return true; return false; } static inline bool match_norton_24_80(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len != 24) return false; if (MATCH(payload, 0x80, 0x10, 0x00, 0x14)) return true; return false; } static inline bool match_norton(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (MATCH(data->payload[0], 0x02, 0x0a, 0x00, 0xc0)) { if (data->payload_len[0] != 16) return false; if (data->payload_len[1] != 0) return false; return true; } if (MATCH(data->payload[1], 0x02, 0x0a, 0x00, 0xc0)) { if (data->payload_len[1] != 16) return false; if (data->payload_len[0] != 0) return false; return true; } /* New behaviour observed in 2012 - interesting use of port 53 */ if (match_norton_24_00(data->payload[0], data->payload_len[0])) { if (data->server_port != 53 && data->client_port != 53) return false; if (match_norton_24_80(data->payload[1], data->payload_len[1])) return true; } if (match_norton_24_00(data->payload[1], data->payload_len[1])) { if (data->server_port != 53 && data->client_port != 53) return false; if (match_norton_24_80(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_norton = { LPI_PROTO_UDP_NORTON, LPI_CATEGORY_SECURITY, "Norton_UDP", 5, match_norton }; void register_norton(LPIModuleMap *mod_map) { register_protocol(&lpi_norton, mod_map); } ================================================ FILE: lib/udp/lpi_ntp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ntp_request(uint32_t payload, uint32_t len) { uint8_t first; uint8_t *ptr; uint8_t version; if (len != 48 && len != 68 && len != 64) return false; ptr = (uint8_t *)&payload; first = *ptr; //first = (uint8_t) (payload); version = (first & 0x38) >> 3; if (version > 4 || version == 0) return false; return true; } static inline bool match_version0_request(uint32_t payload, uint32_t len) { uint32_t secondbyte = 0; if (len != 48) return false; /* Only supporting the 'clock good' status for now */ if (!MATCH(payload, 0x00, ANY, ANY, ANY)) return false; secondbyte = ((ntohl(payload) >> 16) & 0xff); if (secondbyte > 4) return false; return true; } static inline bool match_ntp_response(uint32_t payload, uint32_t len) { uint8_t first; uint8_t version; uint8_t mode; /* Server may not have replied */ if (len == 0) return true; first = (uint8_t) (payload); version = (first & 0x38) >> 3; mode = (first & 0x07); if (version > 4 || version == 0) return false; if (mode == 3) return false; return true; } static inline bool match_ntp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Force NTP to be on port 123 */ if (data->server_port != 123 && data->client_port != 123) return false; if (match_ntp_request(data->payload[0], data->payload_len[0])) { if (match_ntp_response(data->payload[1], data->payload_len[1])) return true; } if (match_ntp_request(data->payload[1], data->payload_len[1])) { if (match_ntp_response(data->payload[0], data->payload_len[0])) return true; } if (match_version0_request(data->payload[0], data->payload_len[0])) { if (match_ntp_response(data->payload[1], data->payload_len[1])) return true; } if (match_version0_request(data->payload[1], data->payload_len[1])) { if (match_ntp_response(data->payload[0], data->payload_len[0])) return true; } /* OK, turns out we can have NTP servers that keep sending responses * without a specific request from the client */ if (match_ntp_response(data->payload[0], data->payload_len[0]) && data->payload_len[0] == 48 && data->payload_len[1] == 0) { return true; } if (match_ntp_response(data->payload[1], data->payload_len[1]) && data->payload_len[1] == 48 && data->payload_len[0] == 0) { return true; } return false; } static lpi_module_t lpi_ntp = { LPI_PROTO_UDP_NTP, LPI_CATEGORY_SERVICES, "NTP", 2, match_ntp }; void register_ntp(LPIModuleMap *mod_map) { register_protocol(&lpi_ntp, mod_map); } ================================================ FILE: lib/udp/lpi_ntp_reflect.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_monlist(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 0x17, 0x00, 0x03, 0x2a)) return true; return false; } static inline bool match_monlist_reply(uint32_t payload, uint32_t len) { /* Hopefully nobody replies :) */ if (len == 0) return true; /* NTPv2 reply */ if (MATCH(payload, 0x97, 0x00, 0x03, 0x2a)) return true; if (MATCH(payload, 0xd7, ANY, 0x03, 0x2a)) return true; /* NTPv3 reply */ if (MATCH(payload, 0x9f, 0x00, 0x03, 0x2a)) return true; if (MATCH(payload, 0xdf, 0x00, 0x03, 0x2a)) return true; return false; } static inline bool match_ntp_reflect(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 123 && data->client_port != 123) return false; if (match_monlist(data->payload[0], data->payload_len[0])) { if (match_monlist_reply(data->payload[1], data->payload_len[1])) return true; } if (match_monlist(data->payload[1], data->payload_len[1])) { if (match_monlist_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_ntp_reflect = { LPI_PROTO_UDP_NTP_REFLECT, LPI_CATEGORY_MALWARE, "NTPReflection", 50, match_ntp_reflect }; void register_ntp_reflect(LPIModuleMap *mod_map) { register_protocol(&lpi_ntp_reflect, mod_map); } ================================================ FILE: lib/udp/lpi_nvidia_gamestream.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_gs_ping(uint32_t payload, uint32_t len) { if (len == 4 && MATCHSTR(payload, "PING")) { return true; } return false; } static inline bool match_gs_rtp(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x80, 0x61, 0x00, 0x00)) { if (len == 72) { return true; } } if (MATCH(payload, 0x90, 0x67, 0x00, 0x00)) { if (len == 1040) { return true; } } return false; } static inline bool match_nvidia_gamestream(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_gs_ping(data->payload[0], data->payload_len[0])) { if (match_gs_rtp(data->payload[1], data->payload_len[1])) { return true; } } if (match_gs_ping(data->payload[1], data->payload_len[1])) { if (match_gs_rtp(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_nvidia_gamestream = { LPI_PROTO_UDP_NVIDIA_GAMESTREAM, LPI_CATEGORY_GAMING, "NVIDIAGamestream", 99, match_nvidia_gamestream }; void register_nvidia_gamestream(LPIModuleMap *mod_map) { register_protocol(&lpi_nvidia_gamestream, mod_map); } ================================================ FILE: lib/udp/lpi_nwn.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_nwn(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "BNES")) return true; return false; } static lpi_module_t lpi_nwn = { LPI_PROTO_UDP_NEVERWINTER, LPI_CATEGORY_GAMING, "NeverwinterNights", 4, match_nwn }; void register_nwn(LPIModuleMap *mod_map) { register_protocol(&lpi_nwn, mod_map); } ================================================ FILE: lib/udp/lpi_opaserv.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Matches the Opaserv worm that attacks UDP port 137 * Ref: http://www.usenix.org/events/osdi04/tech/full_papers/singh/singh_html/ */ static inline bool match_opaserv(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* The recipient does not reply (usually) */ if (data->payload_len[0] > 0 && data->payload_len[1] > 0) return false; if (data->server_port != 137 && data->client_port != 137) return false; if (match_chars_either(data, 0x01, 0x00, 0x00, 0x10)) return true; return false; } static lpi_module_t lpi_opaserv = { LPI_PROTO_UDP_OPASERV, LPI_CATEGORY_MALWARE, "Opaserv", 10, match_opaserv }; void register_opaserv(LPIModuleMap *mod_map) { register_protocol(&lpi_opaserv, mod_map); } ================================================ FILE: lib/udp/lpi_openvpn.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Thanks to Remy Mudingay for providing traces to identify this protocol */ static inline bool match_openvpn_handshake(uint32_t pl_a, uint32_t pl_b) { /* 0x31 and 0x37 are commonly used as the first byte of a UDP * OpenVPN exchange. However, if one end uses 0x31 then the other * must also use 0x31 -- same for 0x37. */ if (MATCH(pl_a, 0x31, ANY, ANY, ANY)) { if (MATCH(pl_b, 0x31, ANY, ANY, ANY)) return true; } if (MATCH(pl_a, 0x37, ANY, ANY, ANY)) { if (MATCH(pl_b, 0x37, ANY, ANY, ANY)) return true; } if (MATCH(pl_a, 0x49, ANY, ANY, ANY)) { if (MATCH(pl_b, 0x49, ANY, ANY, ANY)) return true; } return false; } static inline bool match_tunnelbear_40(uint32_t payload, uint32_t len) { if (!MATCH(payload, 0x40, ANY, ANY, ANY)) return false; if (len != 26) return false; return true; } static inline bool match_tunnelbear_38(uint32_t payload, uint32_t len) { if (!MATCH(payload, 0x38, ANY, ANY, ANY)) return false; if (len != 14 && len != 126 && len != 128) return false; return true; } static inline bool match_wscribe_40(uint32_t payload, uint32_t len) { if (!MATCH(payload, 0x40, ANY, ANY, ANY)) return false; if (len != 98) return false; return true; } static inline bool match_wscribe_38(uint32_t payload, uint32_t len) { if (!MATCH(payload, 0x38, ANY, ANY, ANY)) return false; if (len != 86) return false; return true; } static inline bool match_openvpn_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* The payload matching alone isn't very strong, so I'm going to * add a port-based condition as well. Default port for OpenVPN * is UDP 1194 */ if (data->server_port == 1194 || data->client_port == 1194) { /* Just match the two-way stuff for now */ if (match_openvpn_handshake(data->payload[0], data->payload[1])) return true; } /* These are based on traffic seen involving TunnelBear hosts */ if (match_tunnelbear_40(data->payload[0], data->payload_len[0])) { if (match_tunnelbear_38(data->payload[1], data->payload_len[1])) return true; } if (match_tunnelbear_40(data->payload[1], data->payload_len[1])) { if (match_tunnelbear_38(data->payload[0], data->payload_len[0])) return true; } /* Similar for Windscribe */ if (data->server_port == 443 || data->client_port == 443) { if (match_wscribe_40(data->payload[0], data->payload_len[0])) { if (match_wscribe_38(data->payload[1], data->payload_len[1])) return true; } if (match_wscribe_40(data->payload[1], data->payload_len[1])) { if (match_wscribe_38(data->payload[0], data->payload_len[0])) return true; } } return false; } static lpi_module_t lpi_openvpn_udp = { LPI_PROTO_UDP_OPENVPN, LPI_CATEGORY_TUNNELLING, "OpenVPN_UDP", 12, match_openvpn_udp }; void register_openvpn_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_openvpn_udp, mod_map); } ================================================ FILE: lib/udp/lpi_orbit.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_orbit_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 0xaa, 0x20, ANY, ANY) && len == 36) return true; if (MATCH(payload, 0xaa, 0x10, ANY, ANY) && len == 27) return true; if (MATCH(payload, 0xaa, 0x18, ANY, ANY) && len == 27) return true; if (MATCH(payload, 0xaa, 0x28, ANY, ANY) && len == 120) return true; if (MATCH(payload, 0xab, ANY, 0x78, 0xda)) return true; return false; } static inline bool match_orbit_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* There's no nice spec for the Orbit UDP protocol, so I'm just * going to match based on evidence observed thus far */ if (!match_orbit_payload(data->payload[0], data->payload_len[0])) return false; if (!match_orbit_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_orbit_udp = { LPI_PROTO_UDP_ORBIT, LPI_CATEGORY_FILES, "Orbit_UDP", 3, match_orbit_udp }; void register_orbit_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_orbit_udp, mod_map); } ================================================ FILE: lib/udp/lpi_overwatch.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Not 100% confirmed, mainly because there is no trial or F2P version of * Overwatch to test against. Would be great if anyone out there who owns * Overwatch to confirm this for me :) */ static inline bool match_owatch_cc(uint32_t payload, uint32_t len) { if (MATCH(payload, 0xcc, 0x8e, 0x5f, 0x0d)) return true; return false; } static inline bool match_owatch_df(uint32_t payload, uint32_t len) { if (len == 0) return true; if ((ntohl(payload) & 0xfffff000) == 0xdffcf000) return true; return false; } static inline bool match_overwatch(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_owatch_cc(data->payload[0], data->payload_len[0])) { if (match_owatch_df(data->payload[1], data->payload_len[1])) return true; } if (match_owatch_cc(data->payload[1], data->payload_len[1])) { if (match_owatch_df(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_overwatch = { LPI_PROTO_UDP_OVERWATCH, LPI_CATEGORY_GAMING, "Overwatch", 12, match_overwatch }; void register_overwatch(LPIModuleMap *mod_map) { register_protocol(&lpi_overwatch, mod_map); } ================================================ FILE: lib/udp/lpi_paladins.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_pd_570(uint32_t payload, uint32_t len) { if (len == 570 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_pd_46(uint32_t payload, uint32_t len) { /* The first byte starts at 0x01 and increments for each * subsequent flow */ if (len == 46 && MATCH(payload, ANY, 0x00, 0x00, 0x00)) return true; return false; } static inline bool port_range_check(uint16_t porta, uint16_t portb) { if (porta >= 9000 && porta < 10000) return true; if (portb >= 9000 && portb < 10000) return true; return false; } static inline bool match_paladins(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!port_range_check(data->server_port, data->client_port)) return false; if (match_pd_570(data->payload[0], data->payload_len[0])) { if (match_pd_46(data->payload[1], data->payload_len[1])) return true; } if (match_pd_570(data->payload[1], data->payload_len[1])) { if (match_pd_46(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_paladins = { LPI_PROTO_UDP_PALADINS, LPI_CATEGORY_GAMING, "Paladins", 203, match_paladins }; void register_paladins(LPIModuleMap *mod_map) { register_protocol(&lpi_paladins, mod_map); } ================================================ FILE: lib/udp/lpi_pando.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* This seems to be a Pando thing - I've found libtorrent handshakes within * full payload captures of these packets that refer to Pando peer exchange. * * It may be a wider Bittorrent thing, but I haven't found any evidence to * suggest that any clients other than Pando use it */ static inline bool match_pando_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "\x00\x00\x00\x09", "\x00\x00\x00\x09")) return true; if (MATCH(data->payload[0], 0x00, 0x00, 0x00, 0x09) && data->payload_len[1] == 0) return true; if (MATCH(data->payload[1], 0x00, 0x00, 0x00, 0x09) && data->payload_len[0] == 0) return true; /* This is something I've observed going to hosts belonging to * Pando */ if (match_str_both(data, "UDPA", "UDPR")) return true; if (match_str_both(data, "UDPA", "UDPE")) return true; if (match_str_either(data, "UDPA")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } return false; } static lpi_module_t lpi_pando_udp = { LPI_PROTO_UDP_PANDO, LPI_CATEGORY_P2P, "Pando_UDP", 10, match_pando_udp }; void register_pando_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_pando_udp, mod_map); } ================================================ FILE: lib/udp/lpi_panipani.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* https://play.google.com/store/apps/details?id=jp.colopl.pcat */ static inline bool match_pani_42(uint32_t payload, uint32_t len) { if (len == 40 && MATCH(payload, 0x42, 0x00, ANY, 0x00)) return true; return false; } static inline bool match_pani_4a(uint32_t payload, uint32_t len) { if (len == 1051 && MATCH(payload, 0x4a, 0x80, 0x00, 0x00)) return true; return false; } static inline bool match_panipani(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 7101, 7102 or 7103 */ if (match_pani_42(data->payload[0], data->payload_len[0])) { if (match_pani_4a(data->payload[1], data->payload_len[1])) return true; } if (match_pani_42(data->payload[1], data->payload_len[1])) { if (match_pani_4a(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_panipani = { LPI_PROTO_UDP_PANIPANI, LPI_CATEGORY_GAMING, "Panipani", 101, match_panipani }; void register_panipani(LPIModuleMap *mod_map) { register_protocol(&lpi_panipani, mod_map); } ================================================ FILE: lib/udp/lpi_planetside2.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_planetside_35(uint32_t payload, uint32_t len) { if (len != 35) return false; if (!MATCH(payload, 0x00, 0x01, 0x00, 0x00)) return false; return true; } static inline bool match_planetside_21(uint32_t payload, uint32_t len) { if (len != 21) return false; if (!MATCH(payload, 0x00, 0x02, ANY, ANY)) return false; return true; } static inline bool match_planetside2(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_planetside_35(data->payload[0], data->payload_len[0])) { if (match_planetside_21(data->payload[1], data->payload_len[1])) return true; } if (match_planetside_35(data->payload[1], data->payload_len[1])) { if (match_planetside_21(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_planetside2 = { LPI_PROTO_UDP_PLANETSIDE2, LPI_CATEGORY_GAMING, "Planetside2", 17, match_planetside2 }; void register_planetside2(LPIModuleMap *mod_map) { register_protocol(&lpi_planetside2, mod_map); } ================================================ FILE: lib/udp/lpi_portmap_rpc.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_portmap_rpc(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 111 && data->client_port != 111) return false; if (data->payload_len[0] > 0 && data->payload_len[1] > 0) { if (data->payload[0] != data->payload[1]) return false; } if (data->payload_len[0] == 46 || data->payload_len[1] == 46) return true; if (data->payload_len[0] == 40 || data->payload_len[1] == 40) return true; return false; } static lpi_module_t lpi_portmap_rpc = { LPI_PROTO_UDP_PORTMAP_RPC, LPI_CATEGORY_SERVICES, "PortmapRPC", 220, match_portmap_rpc }; void register_portmap_rpc(LPIModuleMap *mod_map) { register_protocol(&lpi_portmap_rpc, mod_map); } ================================================ FILE: lib/udp/lpi_pplive.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool obs_pplive_req(uint32_t payload, uint32_t len) { /* There's always a 94 byte packet involved */ if (payload == 0) return false; if (len == 94) return true; return false; } static inline bool obs_pplive_resp(uint32_t len, bool knownport) { if (len == 0 && knownport) return true; if (len == 94) return true; if (len == 49 && knownport) return true; return false; } static inline bool match_obscure_pplive(lpi_data_t *data) { /* This is pretty tough stuff to match - the 4 bytes of payload * is random, but the packet sizes seem consistent. * * DPI tools suggest this traffic is pplive, so we'll go with that * in the absence of any other documentation :/ */ bool knownport = false; /* Restrict non-94 byte responses to port 5041 */ if (data->server_port == 5041 || data->client_port == 5041) knownport = true; if (obs_pplive_req(data->payload[0], data->payload_len[0]) && obs_pplive_resp(data->payload_len[1], knownport)) return true; if (obs_pplive_req(data->payload[1], data->payload_len[1]) && obs_pplive_resp(data->payload_len[0], knownport)) return true; return false; } static inline bool match_pplive(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "\xe9\x03\x41\x01", "\xe9\x03\x42\x01")) return true; if (match_str_both(data, "\xe9\x03\x41\x01", "\xe9\x03\x41\x01")) return true; if (match_str_either(data, "\xe9\x03\x41\x01")) { if (data->payload_len[0] == 0 && data->payload_len[1] == 57) return true; if (data->payload_len[1] == 0 && data->payload_len[0] == 57) return true; } /* According to a Chinese paper (Xiaona et al), this is a pattern * for PPLive */ if (match_str_both(data, "\x1c\x1c\x32\x01", "\x1c\x1c\x32\x01")) return true; if (match_obscure_pplive(data)) { return true; } return false; } static lpi_module_t lpi_pplive = { LPI_PROTO_UDP_PPLIVE, LPI_CATEGORY_P2PTV, "PPLive", 203, match_pplive }; void register_pplive(LPIModuleMap *mod_map) { register_protocol(&lpi_pplive, mod_map); } ================================================ FILE: lib/udp/lpi_ppstream.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" #include static inline bool ppstream_pattern(uint32_t payload) { if (MATCH(payload, ANY, ANY, 0x43, 0x00)) return true; if (MATCH(payload, ANY, ANY, 0x43, 0x22)) return true; if (MATCH(payload, ANY, ANY, 0x43, 0x23)) return true; if (MATCH(payload, ANY, ANY, 0x43, 0x32)) return true; if (MATCH(payload, ANY, ANY, 0x43, 0x46)) return true; if (MATCH(payload, ANY, ANY, 0x43, 0x47)) return true; if (MATCH(payload, ANY, ANY, 0x43, 0x49)) return true; if (MATCH(payload, ANY, ANY, 0x43, 0x4c)) return true; if (MATCH(payload, ANY, ANY, 0x43, 0x4d)) return true; if (MATCH(payload, ANY, ANY, 0x44, 0x73)) return true; if (MATCH(payload, ANY, ANY, 0x44, 0xb2)) return true; if (MATCH(payload, ANY, ANY, 0x44, 0xb5)) return true; if (MATCH(payload, ANY, ANY, 0x55, 0x72)) return true; if (MATCH(payload, ANY, ANY, 0x55, 0x75)) return true; if (MATCH(payload, ANY, ANY, 0x55, 0xb3)) return true; return false; } static inline bool match_ppstream_payload(uint32_t payload, uint32_t len) { uint16_t rep_len = 0; uint32_t swap = ntohl(payload); if (len == 0) return true; /* Seems to be used on start-up to check access to certain * servers owned by PPStream */ if (MATCH(payload, 'e', 'c', 'h', 'o') && len == 5) return true; if (!ppstream_pattern(payload)) return false; /* First two bytes are either len or len - 4 */ rep_len = ntohs((uint16_t)(swap >> 16)); if (rep_len == len) return true; if (rep_len == len - 4) return true; return false; } static inline bool match_8480_ppstream(uint32_t payload, uint32_t len) { if (len == 132 && MATCH(payload, 0x84, 0x80, 0xc0, 0xd1)) return true; if (len == 132 && MATCH(payload, 0x84, 0x80, 0xd1, 0xc0)) return true; return false; } static inline bool match_8580_ppstream(uint32_t payload, uint32_t len) { if (len == 133 && MATCH(payload, 0x85, 0x80, 0xc1, 0xd0)) return true; return false; } static inline bool match_1580_ppstream(uint32_t payload, uint32_t len) { if (len == 24 && MATCH(payload, 0x15, 0x80, 0x40, 0x01)) return true; return false; } static inline bool match_8580_reply(uint32_t payload, uint32_t len) { if (len < 134 || len > 151) { return false; } if (MATCH(payload, ANY, 0x80, ANY, ANY)) { return true; } return false; } static inline bool match_80_ppstream(uint32_t payload, uint32_t len) { uint32_t hlen = ntohl(payload) >> 24; if (MATCH(payload, ANY, 0x80, ANY, ANY)) { if (len == hlen ) return true; /* There must be a minimum datagram size */ if (len == 24 && hlen < 24) return true; } return false; } static inline bool match_any84(uint32_t payload, uint32_t len) { if (MATCH(payload, ANY, 0x84, ANY, ANY)) { if (len >= 1065 && len <= 1100) return true; } return false; } static inline bool match_any80(uint32_t payload, uint32_t len) { /* Only examples so far are 0x25806144, len=33 -- need to * see more users to confirm if this is a constant payload */ if (MATCH(payload, ANY, 0x80, ANY, ANY)) { if (len == 33) return true; } return false; } static inline bool match_ppstream(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_ppstream_payload(data->payload[0], data->payload_len[0])) { if (match_ppstream_payload(data->payload[1], data->payload_len[1])) return true; } if (match_8480_ppstream(data->payload[0], data->payload_len[0])) { if (MATCH(data->payload[1], ANY, 0x80, ANY, ANY)) return true; } if (match_8480_ppstream(data->payload[1], data->payload_len[1])) { if (MATCH(data->payload[0], ANY, 0x80, ANY, ANY)) return true; } if (match_80_ppstream(data->payload[0], data->payload_len[0])) { if (match_80_ppstream(data->payload[1], data->payload_len[1])) return true; } if (match_any84(data->payload[0], data->payload_len[0])) { if (match_any80(data->payload[1], data->payload_len[1])) return true; } if (match_any80(data->payload[0], data->payload_len[0])) { if (match_any84(data->payload[1], data->payload_len[1])) return true; } if (match_8580_ppstream(data->payload[0], data->payload_len[0])) { if (match_8580_reply(data->payload[1], data->payload_len[1])) return true; } if (match_8580_ppstream(data->payload[1], data->payload_len[1])) { if (match_8580_reply(data->payload[0], data->payload_len[0])) return true; } if (match_1580_ppstream(data->payload[0], data->payload_len[0])) { /* 8580 reply is intention here -- it's the same reply * pattern for both 1580 and 8580 */ if (match_8580_reply(data->payload[1], data->payload_len[1])) return true; } if (match_1580_ppstream(data->payload[1], data->payload_len[1])) { if (match_8580_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_ppstream = { LPI_PROTO_UDP_PPSTREAM, LPI_CATEGORY_P2PTV, "PPStream", 150, match_ppstream }; void register_ppstream(LPIModuleMap *mod_map) { register_protocol(&lpi_ppstream, mod_map); } ================================================ FILE: lib/udp/lpi_probable_gnutella.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_probable_gnutella(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* XXX This could well be prone to false positives, so definitely * check this one LAST */ if (data->payload_len[0] == 35 && data->payload_len[1] == 0) return true; if (data->payload_len[1] == 35 && data->payload_len[0] == 0) return true; return false; } static lpi_module_t lpi_probable_gnutella = { LPI_PROTO_UDP_GNUTELLA, LPI_CATEGORY_P2P, "Gnutella_UDP", 255, /* This is a really bad rule - make it extremely low priority */ match_probable_gnutella }; void register_probable_gnutella(LPIModuleMap *mod_map) { register_protocol(&lpi_probable_gnutella, mod_map); } ================================================ FILE: lib/udp/lpi_ps4_remoteplay.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool valid_port(uint16_t porta, uint16_t portb) { if (porta == 9296 || portb == 9296) return true; if (porta == 9297 || portb == 9297) return true; return false; } static inline bool match_ps4_remoteplay(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!valid_port(data->server_port, data->client_port)) return false; /* Examples that I have are 88 bytes, but this probably depends on * lengths of user and device names */ if (data->payload_len[0] != data->payload_len[1]) return false; if (MATCH(data->payload[0], 0x01, 0x00, 0x00, 0x00)) { if (MATCH(data->payload[1], 0x01, 0x00, 0x00, 0x00)) return true; } return false; } static lpi_module_t lpi_ps4_remoteplay = { LPI_PROTO_UDP_PS4_REMOTEPLAY, LPI_CATEGORY_GAMING, "PS4_RemotePlay", 150, match_ps4_remoteplay }; void register_ps4_remoteplay(LPIModuleMap *mod_map) { register_protocol(&lpi_ps4_remoteplay, mod_map); } ================================================ FILE: lib/udp/lpi_psn.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_psn_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; /* Seen on udp port 3658 */ if (MATCH(payload, 0xff, 0x83, 0xff, 0xfe)) return true; /* Seen on udp port 9306 */ if (MATCH(payload, 0xff, 0x83, 0xff, 0xfd)) return true; return false; } static inline bool match_psn(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_psn_payload(data->payload[0], data->payload_len[0])) { if (match_psn_payload(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_psn = { LPI_PROTO_UDP_PSN, LPI_CATEGORY_GAMING, "PSN", 3, match_psn }; void register_psn(LPIModuleMap *mod_map) { register_protocol(&lpi_psn, mod_map); } ================================================ FILE: lib/udp/lpi_punkbuster.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Punkbuster: anti-cheating software for online games. Uses its own * protocol for keeping the local PB software up to date. */ static inline bool match_pb_req(uint32_t payload, uint32_t len) { /* length 60-65 bytes */ if (MATCH(payload, 'k', 'e', 'y', 0x20)) return true; return false; } static inline bool match_pb_resp(uint32_t payload, uint32_t len) { /* length 49-51 bytes */ if (MATCHSTR(payload, "\xff\xff\xff\xff")) return true; return false; } static inline bool match_punkbuster(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_pb_req(data->payload[1], data->payload_len[1])) { if (match_pb_resp(data->payload[0], data->payload_len[0])) return true; } if (match_pb_req(data->payload[0], data->payload_len[0])) { if (match_pb_resp(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_punkbuster = { LPI_PROTO_UDP_PUNKBUSTER, LPI_CATEGORY_GAMING, "Punkbuster", 9, match_punkbuster }; void register_punkbuster(LPIModuleMap *mod_map) { register_protocol(&lpi_punkbuster, mod_map); } ================================================ FILE: lib/udp/lpi_pyzor.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_pyzor(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "User", "Code")) return true; if (match_str_both(data, "User", "Thre")) return true; if (data->payload_len[0] == 0 || data->payload_len[1] == 0) { if (match_str_either(data, "User")) return true; } return false; } static lpi_module_t lpi_pyzor = { LPI_PROTO_UDP_PYZOR, LPI_CATEGORY_ANTISPAM, "Pyzor", 3, match_pyzor }; void register_pyzor(LPIModuleMap *mod_map) { register_protocol(&lpi_pyzor, mod_map); } ================================================ FILE: lib/udp/lpi_qq.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_qq_chat(lpi_data_t *data) { /* QQ 2006 has a version number of 0x0f5f */ if (match_str_both(data, "\x02\x0f\x5f\x00", "\x02\x0f\x5f\x00")) return true; if (match_str_either(data, "\x02\x0f\x5f\x00")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } if (match_str_both(data, "\x02\x01\x00\x00", "\x02\x01\x00\x00")) { if (data->payload_len[0] == 75 && data->payload_len[1] == 43) return true; if (data->payload_len[1] == 75 && data->payload_len[0] == 43) return true; } if (match_str_both(data, "\x02\x02\x00\x00", "\x02\x02\x00\x00")) { if (data->payload_len[0] == 83 && data->payload_len[1] == 43) return true; if (data->payload_len[1] == 83 && data->payload_len[0] == 43) return true; } if (match_str_both(data, "\x02\x03\x00\x00", "\x02\x03\x00\x00")) { if (data->payload_len[0] == 83 && data->payload_len[1] == 43) return true; if (data->payload_len[1] == 83 && data->payload_len[0] == 43) return true; } if (data->payload[0] == data->payload[1]) { if (!MATCH(data->payload[0], 0x02, ANY, ANY, ANY)) return false; if (data->server_port != 8000 && data->client_port != 8000) return false; return true; } return false; } static inline bool match_qq_video(lpi_data_t *data) { /* Observed when using the QQ app to make video calls */ if (match_str_both(data, "\x28\x00\x00\x00", "\x28\x00\x00\x00")) return true; return false; } static inline bool match_qq_length(uint32_t payload, uint32_t len) { uint32_t plen = (ntohl(payload) >> 8) & 0xffff; if (plen != len) return false; if (MATCH(payload, 0x02, ANY, ANY, ANY)) return true; if (MATCH(payload, 0x3e, ANY, ANY, 0x02)) return true; return false; } static inline bool match_qq(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_qq_chat(data)) return true; if (match_qq_video(data)) return true; if ((data->payload[0] & 0xff000000) == (data->payload[1] & 0xff000000)) { if (!match_qq_length(data->payload[0], data->payload_len[0])) return false; if (!match_qq_length(data->payload[1], data->payload_len[1])) return false; return true; } return false; } static lpi_module_t lpi_qq = { LPI_PROTO_UDP_QQ, LPI_CATEGORY_CHAT, "QQ", 23, match_qq }; void register_qq(LPIModuleMap *mod_map) { register_protocol(&lpi_qq, mod_map); } ================================================ FILE: lib/udp/lpi_qqlive.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_qqlive_p2p(uint32_t payload) { if (MATCH(payload, 0x1a, 0x10, 0x01, 0x20)) return true; return false; } static inline bool match_qqlive_p2p_fe0a(uint32_t payload, uint32_t len) { if (MATCH(payload, 0xfe, 0x0a, 0x00, 0x00) && len == 13) return true; return false; } static inline bool match_qqlive(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->payload_len[0] == 0 || data->payload_len[1] == 0) { if (data->server_port == 53 || data->client_port == 53) return false; } if (match_qqlive_p2p(data->payload[0])) { if (match_qqlive_p2p(data->payload[1])) return true; if (match_qqlive_p2p_fe0a(data->payload[1], data->payload_len[1])) return true; } if (match_qqlive_p2p(data->payload[1])) { if (match_qqlive_p2p(data->payload[0])) return true; if (match_qqlive_p2p_fe0a(data->payload[0], data->payload_len[0])) return true; } if (!match_qqlive_payload(data->payload[0], data->payload_len[0])) return false; if (!match_qqlive_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_qqlive = { LPI_PROTO_UDP_QQLIVE, LPI_CATEGORY_P2PTV, "QQLive", 4, match_qqlive }; void register_qqlive(LPIModuleMap *mod_map) { register_protocol(&lpi_qqlive, mod_map); } ================================================ FILE: lib/udp/lpi_qqpcmgr.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Some sort of phone-home protocol mostly used by QQPCMgr, a "security" * program by QQ. * * Appears to occasionally be used by other QQ background processes, like * QQLive, but the background processes created by QQPCMgr uses this * protocol far more than anything else I've seen. */ static inline bool match_qqpcmgr(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 8000 && data->client_port != 8000) return false; if (!MATCH(data->payload[0], 0x00, 0x02, 0x00, ANY)) return false; if (!MATCH(data->payload[1], 0x00, 0x02, 0x00, ANY)) return false; /* Usually byte 4 matches for both payloads, but not always */ return true; } static lpi_module_t lpi_qqpcmgr = { LPI_PROTO_UDP_QQPCMGR, LPI_CATEGORY_SECURITY, "QQPCMgr", 21, match_qqpcmgr }; void register_qqpcmgr(LPIModuleMap *mod_map) { register_protocol(&lpi_qqpcmgr, mod_map); } ================================================ FILE: lib/udp/lpi_qqspeedmobile_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* QQ Speed (mobile version) -- Online Mario Kart clone */ static inline bool match_speed_55(uint32_t payload, uint32_t len) { if (len == 55 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_speed_57(uint32_t payload, uint32_t len) { /* Payload itself is pretty random */ if (len == 57) return true; return false; } static inline bool match_qqspeedmobile_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_speed_55(data->payload[0], data->payload_len[0])) { if (match_speed_57(data->payload[1], data->payload_len[1])) return true; } if (match_speed_57(data->payload[0], data->payload_len[0])) { if (match_speed_55(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_qqspeedmobile_udp = { LPI_PROTO_UDP_QQSPEEDMOBILE, LPI_CATEGORY_GAMING, "QQSpeedMobile_UDP", 100, match_qqspeedmobile_udp }; void register_qqspeedmobile_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_qqspeedmobile_udp, mod_map); } ================================================ FILE: lib/udp/lpi_quake.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_quake_ping(lpi_data_t *data) { /* The client appears to send a "ping" (which is not part of the * documented Quake engine protocol). The server responds with a * standard "ffffffff" packet */ if (MATCHSTR(data->payload[0], "ping") && data->payload_len[0] == 4) { if (data->payload_len[1] == 0) return true; if (data->payload_len[1] != 14) return false; if (MATCHSTR(data->payload[1], "\xff\xff\xff\xff")) return true; return false; } if (MATCHSTR(data->payload[1], "ping") && data->payload_len[1] == 4) { if (data->payload_len[0] == 0) return true; if (data->payload_len[0] != 14) return false; if (MATCHSTR(data->payload[0], "\xff\xff\xff\xff")) return true; return false; } return false; } static inline bool match_qlive_challenge(uint32_t payload, uint32_t len) { /* Not sure whether this length can vary or not? */ if (len == 259) return true; return false; } static inline bool match_qlive_response(uint32_t payload, uint32_t len) { /* Not sure whether this length can vary or not? */ if (len == 33 || len == 32 || len == 31 || len == 30) return true; return false; } static inline bool match_quake(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Trying to match generic Quake engine games - typically use port * 27960 */ if (match_quake_ping(data)) return true; if (!match_str_both(data, "\xff\xff\xff\xff", "\xff\xff\xff\xff")) return false; if (data->payload_len[0] == 16) { if (data->payload_len[1] >= 51 && data->payload_len[1] <= 54) return true; if (data->payload_len[1] >= 30 && data->payload_len[1] <= 33) return true; if (data->server_port == 27960 || data->client_port == 27960) { if (data->payload_len[1] >= 800 && data->payload_len[1] <= 812) return true; } } if (data->payload_len[1] == 16) { if (data->payload_len[0] >= 51 && data->payload_len[0] <= 54) return true; if (data->payload_len[0] >= 30 && data->payload_len[0] <= 33) return true; if (data->server_port == 27960 || data->client_port == 27960) { if (data->payload_len[0] >= 800 && data->payload_len[0] <= 812) return true; } } if (match_qlive_challenge(data->payload[0], data->payload_len[0])) { if (match_qlive_response(data->payload[1], data->payload_len[1])) return true; } if (match_qlive_challenge(data->payload[1], data->payload_len[1])) { if (match_qlive_response(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_quake = { LPI_PROTO_UDP_QUAKE, LPI_CATEGORY_GAMING, "Quake", 6, match_quake }; void register_quake(LPIModuleMap *mod_map) { register_protocol(&lpi_quake, mod_map); } ================================================ FILE: lib/udp/lpi_quic.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Based on both the QUIC spec: * https://docs.google.com/document/d/1WJvyZflAO2pq77yOLbp9NsGjC1CHetAXV8I0fQe-B_U/edit * and traffic observed in the wild. */ static inline bool match_quic_version(uint32_t payload) { /* Public flags for a Version Negotiation packet must be * 0x0d */ if (MATCH(payload, 0x0d, ANY, ANY, ANY)) { return true; } /* 0x09 can also work in the case where there is no * diversification nonce in the header */ if (MATCH(payload, 0x09, ANY, ANY, ANY)) { return true; } /* Apparently 0x0c and 0x0e can also work here? */ if (MATCH(payload, 0x0c, ANY, ANY, ANY)) { return true; } if (MATCH(payload, 0x0e, ANY, ANY, ANY)) { return true; } return false; } static inline bool match_quic_response(uint32_t payload, uint32_t other) { uint32_t seq8 = (ntohl(payload) >> 16) & 0xff; /* Public flags are 0x00 for a packet with a single byte of * sequence number and no connection id */ if (MATCH(payload, 0x00, ANY, ANY, ANY)) { /* This *is* UDP, so we might miss some of the first * few datagrams... */ if (seq8 >= 1 && seq8 <= 10) return true; } /* Otherwise, connection IDs must match for both directions */ if (MATCH(payload, 0x0c, ANY, ANY, ANY)) { if ((payload & 0xffffff00) == (other & 0xffffff00)) return true; } if (MATCH(payload, 0x0e, ANY, ANY, ANY)) { if ((payload & 0xffffff00) == (other & 0xffffff00)) return true; } /* This is the 4 byte connection ID case */ if (MATCH(payload, 0x08, ANY, ANY, ANY)) { if ((payload & 0xffffff00) == (other & 0xffffff00)) return true; } /* This is the 4 byte diversification nonce case, with no other * flags set. */ if (MATCH(payload, 0x04, ANY, ANY, ANY)) { return true; } return false; } static inline bool match_quic_port(lpi_data_t *data) { if (data->server_port == 443) return true; if (data->client_port == 443) return true; if (data->server_port == 80) return true; if (data->client_port == 80) return true; return false; } /* Match old Google QUIC versions */ static inline bool match_old_gquic(lpi_data_t *data) { if (match_quic_version(data->payload[0])) { if (match_quic_response(data->payload[1], data->payload[0])) return true; } if (match_quic_version(data->payload[1])) { if (match_quic_response(data->payload[0], data->payload[1])) return true; } /* Matches against an in-progress QUIC flow * XXX not overly robust, may produce false positives... */ if (MATCH(data->payload[0], 0x10, ANY, ANY, ANY)) { if (MATCH(data->payload[1], 0x0c, ANY, ANY, ANY)) return true; if (MATCH(data->payload[1], 0x1c, ANY, ANY, ANY)) return true; } if (MATCH(data->payload[0], 0x00, ANY, ANY, ANY)) { if (MATCH(data->payload[1], 0x0c, ANY, ANY, ANY)) return true; if (MATCH(data->payload[1], 0x1c, ANY, ANY, ANY)) return true; } if (MATCH(data->payload[1], 0x10, ANY, ANY, ANY)) { if (MATCH(data->payload[0], 0x0c, ANY, ANY, ANY)) return true; if (MATCH(data->payload[0], 0x1c, ANY, ANY, ANY)) return true; } if (MATCH(data->payload[1], 0x00, ANY, ANY, ANY)) { if (MATCH(data->payload[0], 0x0c, ANY, ANY, ANY)) return true; if (MATCH(data->payload[0], 0x1c, ANY, ANY, ANY)) return true; } return false; } static inline bool match_05X_req(uint32_t payload, uint32_t len) { if ((ntohl(payload) & 0xf0000000) != 0xc0000000) { return false; } if (MATCH(payload, ANY, 0x51, 0x30, 0x35)) { if (len == 42) { return true; } if (len == 1350 || len == 1330) { return true; } } if (MATCH(payload, ANY, 0x54, 0x30, 0x35)) { if (len == 1350 || len == 1330) { return true; } } return false; } static inline bool match_05X_reply(uint32_t payload, uint32_t len, uint32_t other) { if ((ntohl(payload) & 0x00ff0000) != (ntohl(other) & 0x00ff0000)) { return false; } if ((ntohl(payload) & 0xf0000000) == 0xc0000000) { if (MATCH(payload, ANY, 0x51, 0x30, 0x35)) { if (len == 1350 || len == 1330) { return true; } } if (MATCH(payload, ANY, 0x54, 0x30, 0x35)) { if (len == 1350 || len == 1330) { return true; } } } if ((ntohl(payload) & 0xff000000) == 0xd5000000) { if (!MATCH(payload, ANY, 0x51, 0x30, 0x35)) { return false; } if (len == 1350 || len == 1330) { return true; } } return false; } static inline bool match_req_q044(uint32_t payload, uint32_t len) { if (MATCHSTR(payload, "\xffQ04") && len == 1350) { return true; } /* IPv6 */ if (MATCHSTR(payload, "\xffQ04") && len == 1330) { return true; } if (MATCH(payload, 0xc3, 'Q', '0', '4') && (len == 36 || len == 1350 || len == 1330)) { return true; } return false; } static inline bool match_reply_q044(uint32_t payload, uint32_t len) { if (MATCH(payload, 0xff, 'Q', '0', '4')) { return true; } if (MATCH(payload, 0xfd, 'Q', '0', '4')) { return true; } if (MATCH(payload, 0xfc, 'Q', '0', '4')) { return true; } if (MATCH(payload, 0xc3, 'Q', '0', '4')) { return true; } if (MATCH(payload, 0xd3, 'Q', '0', '4')) { return true; } if (MATCH(payload, 0xe3, 'Q', '0', '4')) { return true; } return false; } /* IETF QUIC version 44, starting to be deployed by Google */ static inline bool match_quic_044(lpi_data_t *data) { if (match_req_q044(data->payload[0], data->payload_len[0])) { if (match_reply_q044(data->payload[1], data->payload_len[1])) { return true; } } if (match_req_q044(data->payload[1], data->payload_len[1])) { if (match_reply_q044(data->payload[0], data->payload_len[0])) { return true; } } return false; } static inline bool match_quic_05X(lpi_data_t *data) { if (match_05X_req(data->payload[0], data->payload_len[0])) { if (match_05X_reply(data->payload[1], data->payload_len[1], data->payload[0])) { return true; } } if (match_05X_req(data->payload[1], data->payload_len[1])) { if (match_05X_reply(data->payload[0], data->payload_len[0], data->payload[1])) { return true; } } return false; } static inline bool match_reply_fbquic(uint32_t payload, uint32_t len) { if ((len >= 38 && len <= 50) || len == 1252 || len == 1232) { if ((ntohl(payload) & 0xf0000000) != 0xc0000000) { return false; } if (MATCH(payload, ANY, 0xfa, 0xce, 0xb0)) { return true; } } return false; } static inline bool match_req_fbquic(uint32_t payload, uint32_t len) { if (len == 1232 || len == 1235) { if ((ntohl(payload) & 0xf0000000) != 0xc0000000) { return false; } if (MATCH(payload, ANY, 0xfa, 0xce, 0xb0)) { return true; } } return false; } static inline bool match_fb_quic(lpi_data_t *data) { if (match_req_fbquic(data->payload[0], data->payload_len[0])) { if (match_reply_fbquic(data->payload[1], data->payload_len[1])) return true; } if (match_req_fbquic(data->payload[1], data->payload_len[1])) { if (match_reply_fbquic(data->payload[0], data->payload_len[0])) return true; } return false; } static inline bool match_quic(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_quic_port(data)) return false; /* Spec says that packets must not be larger than 1350 bytes */ if (data->payload_len[0] > 1350 || data->payload_len[1] > 1350) return false; if (match_quic_044(data)) { return true; } if (match_quic_05X(data)) { return true; } if (match_fb_quic(data)) { return true; } if (match_old_gquic(data)) { return true; } return false; } static lpi_module_t lpi_quic = { LPI_PROTO_UDP_QUIC, LPI_CATEGORY_WEB, "QUIC", 9, match_quic }; void register_quic(LPIModuleMap *mod_map) { register_protocol(&lpi_quic, mod_map); } ================================================ FILE: lib/udp/lpi_qvod_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_qvod_1(uint32_t payload, uint32_t len) { if (len == 1 && MATCH(payload, 0x30, 0x00, 0x00, 0x00)) { return true; } return false; } static inline bool match_qvod_13(uint32_t payload, uint32_t len) { if (len == 13 && MATCH(payload, 0x00, 0x00, 0x00, 0x0d)) { return true; } return false; } static inline bool match_qvod_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_qvod_13(data->payload[0], data->payload_len[0])) { if (match_qvod_13(data->payload[1], data->payload_len[1])) { return true; } } if (match_qvod_1(data->payload[0], data->payload_len[0])) { if (match_qvod_13(data->payload[1], data->payload_len[1])) { return true; } } if (match_qvod_1(data->payload[1], data->payload_len[1])) { if (match_qvod_13(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_qvod_udp = { LPI_PROTO_UDP_QVOD, LPI_CATEGORY_P2P, "QVOD_UDP", 201, match_qvod_udp }; void register_qvod_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_qvod_udp, mod_map); } ================================================ FILE: lib/udp/lpi_radius.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_radius_request(uint32_t pload, uint32_t len) { uint32_t stated_len = 0; stated_len = ntohl(pload) & 0xffff; if (stated_len != len) return false; /* Access-Request */ if (MATCH(pload, 0x01, ANY, ANY, ANY)) return true; /* Accounting-Request */ if (MATCH(pload, 0x04, ANY, ANY, ANY)) return true; return false; } static inline bool match_radius_resp(uint32_t pload, uint32_t len) { uint32_t stated_len = 0; stated_len = ntohl(pload) & 0xffff; if (stated_len != len) return false; /* Access-Accept */ if (MATCH(pload, 0x02, ANY, ANY, ANY)) return true; /* Access-Reject */ if (MATCH(pload, 0x03, ANY, ANY, ANY)) return true; /* Accounting-Response */ if (MATCH(pload, 0x05, ANY, ANY, ANY)) return true; return false; } static inline bool match_radius(lpi_data_t *data, lpi_module_t *mod UNUSED) { //if (data->server_port != 1812 && data->client_port != 1812) // return false; /* Second byte is the ID field, which must match for both payloads */ if ((ntohl(data->payload[0]) & 0xff0000) != (ntohl(data->payload[1]) & 0xff0000)) return false; if (match_radius_request(data->payload[0], data->payload_len[0])) { if (match_radius_resp(data->payload[1], data->payload_len[1])) return true; } if (match_radius_request(data->payload[1], data->payload_len[1])) { if (match_radius_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_radius = { LPI_PROTO_UDP_RADIUS, LPI_CATEGORY_REMOTE, "Radius", 14, match_radius }; void register_radius(LPIModuleMap *mod_map) { register_protocol(&lpi_radius, mod_map); } ================================================ FILE: lib/udp/lpi_raknet.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_raknet_out(uint32_t payload, uint32_t len) { if (MATCHSTR(payload, "\x05\x00\xff\xff")) return true; return false; } static inline bool match_raknet_in(uint32_t payload, uint32_t len) { if (len != 28) return false; if (MATCHSTR(payload, "\x06\x00\xff\xff")) return true; return false; } static inline bool match_raknet(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_raknet_out(data->payload[0], data->payload_len[0])) { if (match_raknet_in(data->payload[1], data->payload_len[1])) return true; } if (match_raknet_out(data->payload[1], data->payload_len[1])) { if (match_raknet_in(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_raknet = { LPI_PROTO_UDP_RAKNET, LPI_CATEGORY_GAMING, "Raknet", 7, match_raknet }; void register_raknet(LPIModuleMap *mod_map) { register_protocol(&lpi_raknet, mod_map); } ================================================ FILE: lib/udp/lpi_ramseydash.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Gordon Ramsey Dash -- mobile game */ static inline bool match_rdash_56da(uint32_t payload, uint32_t len) { if (len == 24 && MATCH(payload, 0x56, 0xda, 0x00, 0x00)) return true; return false; } static inline bool match_rdash_da57(uint32_t payload, uint32_t len) { if (len >= 120 && len <= 320 && MATCH(payload, 0xda, 0x57, ANY, ANY)) return true; return false; } static inline bool match_ramsey_dash(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_rdash_56da(data->payload[0], data->payload_len[0])) { if (match_rdash_da57(data->payload[1], data->payload_len[1])) return true; } if (match_rdash_56da(data->payload[1], data->payload_len[1])) { if (match_rdash_da57(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_ramsey_dash = { LPI_PROTO_UDP_RAMSEY_DASH, LPI_CATEGORY_GAMING, "RamseyDash", 12, match_ramsey_dash }; void register_ramsey_dash(LPIModuleMap *mod_map) { register_protocol(&lpi_ramsey_dash, mod_map); } ================================================ FILE: lib/udp/lpi_rdp_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_rdp_init(uint32_t payload, uint32_t len) { if (len == 1232 && MATCHSTR(payload, "\xff\xff\xff\xff")) return true; return false; } static inline bool match_rdp_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Seen both 3389 and 4732 used as ports */ if (match_rdp_init(data->payload[0], data->payload_len[0])) { if (match_rdp_init(data->payload[1], data->payload_len[1])) return true; if (data->server_port == 4732 || data->client_port == 4732) { if (data->payload[1] != 0 && data->payload_len[1] == 1232) return true; } if (data->server_port == 3389 || data->client_port == 3389) { if (data->payload[1] != 0 && data->payload_len[1] == 1232) return true; } } if (match_rdp_init(data->payload[1], data->payload_len[1])) { if (data->server_port == 4732 || data->client_port == 4732) { if (data->payload[0] != 0 && data->payload_len[0] == 1232) return true; } if (data->server_port == 3389 || data->client_port == 3389) { if (data->payload[0] != 0 && data->payload_len[0] == 1232) return true; } } return false; } static lpi_module_t lpi_rdp_udp = { LPI_PROTO_UDP_RDP, LPI_CATEGORY_REMOTE, "RDP_UDP", 200, match_rdp_udp }; void register_rdp_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_rdp_udp, mod_map); } ================================================ FILE: lib/udp/lpi_real.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_real(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* The Real Data Transport is not explicitly documented in full, * but these packets seem to resemble those examples we have been able * to find. * * https://protocol.helixcommunity.org/2005/devdocs/RDT_Feature_Level_30.txt */ if (!match_str_both(data, "\x00\xff\x03\x00", "\x00\xff\x04\x49")) return false; if (data->payload_len[0] == 3 && data->payload_len[1] == 11) return true; if (data->payload_len[1] == 3 && data->payload_len[0] == 11) return true; return false; } static lpi_module_t lpi_real = { LPI_PROTO_UDP_REAL, LPI_CATEGORY_STREAMING, "RealPlayer", 3, match_real }; void register_real(LPIModuleMap *mod_map) { register_protocol(&lpi_real, mod_map); } ================================================ FILE: lib/udp/lpi_risingstorm.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* More specifically, this rule is based off Rising Storm 2 but it'll * probably match other Tripwire games including the original. * * TBC against real game traffic, but that costs $$. * All servers contacted were labelled as RS2 on various server tracking * sites, so that's enough for me. */ static inline bool match_rs_0080(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x00, 0x80, 0x05, 0x20)) { if (len == 10 || len == 17) return true; } return false; } static inline bool match_rs_00c0(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x00, 0xc0, ANY, 0x08)) { if (len == 14) return true; } return false; } static inline bool match_rs_0108(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x00, 0x00, 0x01, 0x08)) { if (len == 25 || len == 12) return true; } return false; } static inline bool match_risingstorm(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_rs_0080(data->payload[0], data->payload_len[0])) { if (match_rs_0108(data->payload[1], data->payload_len[1])) return true; if (match_rs_00c0(data->payload[1], data->payload_len[1])) return true; } if (match_rs_0080(data->payload[1], data->payload_len[1])) { if (match_rs_0108(data->payload[0], data->payload_len[0])) return true; if (match_rs_00c0(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_risingstorm = { LPI_PROTO_UDP_RISING_STORM, LPI_CATEGORY_GAMING, "RisingStorm", 12, match_risingstorm }; void register_risingstorm(LPIModuleMap *mod_map) { register_protocol(&lpi_risingstorm, mod_map); } ================================================ FILE: lib/udp/lpi_robocraft.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_robocraft_req(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x09, 0x0b, 0x00, 0x05)) return true; if (MATCH(payload, 0x09, 0x0b, 0x07, 0xd0)) return true; return false; } static inline bool match_robocraft_resp(uint32_t payload, uint32_t len) { if (MATCHSTR(payload, "\x0a\x00\xff\xff")) return true; return false; } static inline bool match_robocraft(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_robocraft_req(data->payload[0], data->payload_len[0])) { if (match_robocraft_resp(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_robocraft = { LPI_PROTO_UDP_ROBOCRAFT, LPI_CATEGORY_GAMING, "Robocraft", 5, match_robocraft }; void register_robocraft(LPIModuleMap *mod_map) { register_protocol(&lpi_robocraft, mod_map); } ================================================ FILE: lib/udp/lpi_rocket_league.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Not confirmed -- RL costs too much money -- but pretty certain */ static inline bool match_rl_1d(uint32_t payload, uint32_t len) { if (len == 115 && MATCH(payload, 0x1d, 0x01, 0x00, 0x00)) { return true; } return false; } static inline bool match_rl_1c(uint32_t payload, uint32_t len) { if (len == 93 && MATCH(payload, 0x1c, 0x01, 0x00, 0x00)) { return true; } return false; } static inline bool match_rocket_league(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_rl_1d(data->payload[0], data->payload_len[0])) { if (match_rl_1c(data->payload[1], data->payload_len[1])) { return true; } } if (match_rl_1c(data->payload[0], data->payload_len[0])) { if (match_rl_1d(data->payload[1], data->payload_len[1])) { return true; } } return false; } static lpi_module_t lpi_rocket_league = { LPI_PROTO_UDP_ROCKET_LEAGUE, LPI_CATEGORY_GAMING, "RocketLeague", 175, match_rocket_league }; void register_rocket_league(LPIModuleMap *mod_map) { register_protocol(&lpi_rocket_league, mod_map); } ================================================ FILE: lib/udp/lpi_rrshare.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* RRshare aka YYets aka Zimuzu (app.zimuzu.tv) */ static inline bool match_rr_short(uint32_t payload, uint32_t len) { if (len == 43 && MATCH(payload, 0x00, 0x00, 0x00, ANY)) return true; if (len == 43 && MATCH(payload, 0x15, 0x00, 0x00, ANY)) return true; return false; } static inline bool match_rr_long(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x01, 0x02, 0x00, ANY)) return true; return false; } static inline bool match_rr_05(uint32_t payload, uint32_t len) { if (len == 0) { return true; } if (MATCH(payload, 0x05, 0x00, 0x00, ANY)) return true; return false; } static inline bool match_rrshare(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_rr_short(data->payload[0], data->payload_len[0])) { if (match_rr_long(data->payload[1], data->payload_len[1])) return true; if (match_rr_short(data->payload[1], data->payload_len[1])) return true; } if (match_rr_short(data->payload[1], data->payload_len[1])) { if (match_rr_long(data->payload[0], data->payload_len[0])) return true; } if (match_rr_long(data->payload[0], data->payload_len[0])) { if (match_rr_05(data->payload[1], data->payload_len[1])) return true; } if (match_rr_long(data->payload[1], data->payload_len[1])) { if (match_rr_05(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_rrshare = { LPI_PROTO_UDP_RRSHARE, LPI_CATEGORY_P2P, "RRShare", 149, match_rrshare }; void register_rrshare(LPIModuleMap *mod_map) { register_protocol(&lpi_rrshare, mod_map); } ================================================ FILE: lib/udp/lpi_rtcp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_rtcp_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 0x81, 0xc8, 0x00, ANY)) return true; if (MATCH(payload, 0x81, 0xc9, 0x00, ANY)) return true; if (MATCH(payload, 0x80, 0xc9, 0x00, ANY)) return true; if (MATCH(payload, 0x80, 0xc8, 0x00, ANY)) return true; return false; } static inline bool match_rtcp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Watch out for one-way DNS... */ if (data->payload_len[0] == 0 || data->payload_len[1] == 0) { if (data->server_port == 53 || data->client_port == 53) return false; } if (!match_rtcp_payload(data->payload[0], data->payload_len[0])) return false; if (!match_rtcp_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_rtcp = { LPI_PROTO_UDP_RTCP, LPI_CATEGORY_VOIP, "RTCP", 3, match_rtcp }; void register_rtcp(LPIModuleMap *mod_map) { register_protocol(&lpi_rtcp, mod_map); } ================================================ FILE: lib/udp/lpi_rtmfp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_rtmfp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* RTMFP is Adobe's proprietary P2P streaming protocol. There are two * stages - communicating with the Stratus servers and then talking * to the peers themselves */ /* Basically we're matching pairs of packet sizes here - not very * reliable at all. Could be lots of false positives! */ /* Hitting the Stratus servers */ if (data->payload_len[0] == 100 && data->payload_len[1] == 180) return true; if (data->payload_len[1] == 100 && data->payload_len[0] == 180) return true; /* P2P */ if (data->payload_len[0] == 228 && data->payload_len[1] == 68) return true; if (data->payload_len[1] == 228 && data->payload_len[0] == 68) return true; if (data->payload_len[0] == 68 && data->payload_len[1] == 68) return true; if (data->payload_len[1] == 68 && data->payload_len[0] == 68) return true; return false; } static lpi_module_t lpi_rtmfp = { LPI_PROTO_UDP_RTMFP, LPI_CATEGORY_STREAMING, "RTMFP", 12, match_rtmfp }; void register_rtmfp(LPIModuleMap *mod_map) { register_protocol(&lpi_rtmfp, mod_map); } ================================================ FILE: lib/udp/lpi_rtp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_rtp_payload(uint32_t payload, uint32_t len, uint32_t other_len) { /* This rule seems very weak -- maybe need to capture some known * RTP traffic to try and strengthen it? */ /* Be stricter about packet length when looking at one-way flows */ if (other_len == 0) { if (len != 32 && len != 92 && len != 172 && len != 31 && len != 24) return false; } if (MATCH(payload, 0x80, ANY, ANY, ANY)) return true; if (MATCH(payload, 0x90, ANY, ANY, ANY)) return true; if (MATCH(payload, 0x91, ANY, ANY, ANY)) return true; return false; } static inline bool match_rtp_806d(uint32_t payload, uint32_t len) { /* Common pattern we see on our local videoconf server */ if (len == 24 && MATCH(payload, 0x80, 0x6d, 0x00, 0x00)) return true; return false; } static inline bool match_rtp_80c9(uint32_t payload, uint32_t len) { if (len == 94 && MATCH(payload, 0x80, 0xc9, 0x00, 0x01)) return true; return false; } static inline bool match_rtcp_report(uint32_t payload, uint32_t len) { if (len == 16 && MATCH(payload, 0x81, 0xcd, 0x00, 0x03)) return true; if (len == 20 && MATCH(payload, 0x81, 0xcd, 0x00, 0x03)) return true; if (len == 32 && MATCH(payload, 0x81, 0xc9, 0x00, 0x07)) return true; if (len == 36 && MATCH(payload, 0x81, 0xc9, 0x00, 0x07)) return true; return false; } static inline bool match_stun_response(uint32_t payload, uint32_t len) { uint32_t plen = ntohl(payload) & 0xffff; /* Many VOIP phones use STUN for NAT traversal, so the response to * outgoing RTP is often a STUN packet */ if (len - 20 == plen && MATCH(payload, 0x00, 0x01, 0x00, ANY)) return true; if (len == 12 && MATCH(payload, 0x00, 0x11, 0x00, 0x00)) return true; /* Facebook-specific STUN? Message type 0x003 is not defined in * any official STUN documentation */ if (len == 126 && MATCH(payload, 0x00, 0x03, 0x00, 0x6a)) return true; if (len == 94 && MATCH(payload, 0x00, 0x03, 0x00, 0x4a)) return true; return false; } static inline bool match_rtp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Watch out for one-way DNS... */ if (data->client_port == 53 || data->client_port == 53) { if (data->payload_len[0] == 0 || data->payload_len[1] == 0) return false; } if (match_rtp_806d(data->payload[0], data->payload_len[0])) { if (match_rtp_payload(data->payload[1], data->payload_len[1], data->payload_len[0])) return true; } if (match_rtp_806d(data->payload[1], data->payload_len[1])) { if (match_rtp_payload(data->payload[0], data->payload_len[0], data->payload_len[1])) return true; } if (match_rtp_80c9(data->payload[0], data->payload_len[0])) { if (match_stun_response(data->payload[1], data->payload_len[1])) return true; } if (match_rtp_80c9(data->payload[1], data->payload_len[1])) { if (match_stun_response(data->payload[0], data->payload_len[0])) return true; } if (match_rtp_payload(data->payload[0], data->payload_len[0], data->payload_len[1])) { if (match_stun_response(data->payload[1], data->payload_len[1])) return true; if (match_rtp_payload(data->payload[1], data->payload_len[1], data->payload_len[0])) { uint32_t a = ntohl(data->payload[0]) & 0xffff0000; uint32_t b = ntohl(data->payload[1]) & 0xffff0000; if (a == b) return true; return false; } if (data->payload_len[1] == 0) return true; } if (match_rtp_payload(data->payload[1], data->payload_len[1], data->payload_len[0])) { if (match_stun_response(data->payload[0], data->payload_len[0])) return true; if (data->payload_len[0] == 0) return true; } if (match_rtcp_report(data->payload[0], data->payload_len[0])) { if (match_rtp_payload(data->payload[1], data->payload_len[1], data->payload_len[0])) return true; } if (match_rtcp_report(data->payload[1], data->payload_len[1])) { if (match_rtp_payload(data->payload[0], data->payload_len[0], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_rtp = { LPI_PROTO_UDP_RTP, LPI_CATEGORY_VOIP, "RTP", 33, match_rtp }; void register_rtp(LPIModuleMap *mod_map) { register_protocol(&lpi_rtp, mod_map); } ================================================ FILE: lib/udp/lpi_rulesofsurvival.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Rules of Survival -- battle royale from NetEase for mobile and PC */ /* Based on PC version -- mobile may be different? */ static inline bool match_ros_24(uint32_t payload, uint32_t len) { if (len == 24 && MATCH(payload, 0x01, 0x00, 0x00, 0x0b)) { return true; } return false; } static inline bool match_ros_32(uint32_t payload, uint32_t len) { if (len == 32) { /* Payload is seemingly random, so rule out common * patterns that are very unlikely to come up randomly. */ if (MATCH(payload, 0x00, 0x00, 0x00, 0x00)) { return false; } if (MATCHSTR(payload, "\xff\xff\xff\xff")) { return false; } return true; } return false; } static inline bool match_rulesofsurvival(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_ros_24(data->payload[0], data->payload_len[0])) { if (match_ros_32(data->payload[1], data->payload[1])) return true; } if (match_ros_24(data->payload[1], data->payload_len[1])) { if (match_ros_32(data->payload[0], data->payload[0])) return true; } return false; } static lpi_module_t lpi_rulesofsurvival = { LPI_PROTO_UDP_RULES_OF_SURVIVAL, LPI_CATEGORY_GAMING, "RulesOfSurvival", 123, match_rulesofsurvival }; void register_rulesofsurvival(LPIModuleMap *mod_map) { register_protocol(&lpi_rulesofsurvival, mod_map); } ================================================ FILE: lib/udp/lpi_sanandreas_mp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Matches the GTA: San Andreas Multiplayer Mod -- http://www.sa-mp.com/ */ static inline bool match_samp_request(uint32_t payload, uint32_t len) { if (!MATCHSTR(payload, "SAMP")) return false; if (len != 71) return false; return true; } static inline bool match_samp_reply(uint32_t payload, uint32_t len) { if (len == 0) return true; if (!MATCHSTR(payload, "SAMP")) return false; if (len == 11 || len == 15) return true; return false; } static inline bool match_ffs_req(uint32_t payload, uint32_t len) { if (len != 4) return false; if (MATCH(payload, 0x40, 0xb1, 0xd1, 0xef)) return true; return false; } static inline bool match_ffs_resp(uint32_t payload, uint32_t len) { if (len != 2) return false; if (MATCH(payload, 0x16, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_sanandreas_mp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_samp_request(data->payload[0], data->payload_len[0])) { if (match_samp_reply(data->payload[1], data->payload_len[1])) return true; } if (match_samp_request(data->payload[1], data->payload_len[1])) { if (match_samp_reply(data->payload[0], data->payload_len[0])) return true; } /* Traffic seen on port 7777 for a SA-MP server called * Fight Fun Server (ff-server.com). */ if (match_ffs_req(data->payload[1], data->payload_len[1])) { if (match_ffs_resp(data->payload[0], data->payload_len[0])) return true; } if (match_ffs_req(data->payload[0], data->payload_len[0])) { if (match_ffs_resp(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_sanandreas_mp = { LPI_PROTO_UDP_SANANDREAS, LPI_CATEGORY_GAMING, "GTA_SanAndreas_Multiplayer", 8, match_sanandreas_mp }; void register_sanandreas_mp(LPIModuleMap *mod_map) { register_protocol(&lpi_sanandreas_mp, mod_map); } ================================================ FILE: lib/udp/lpi_second_life.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_second_life_req(uint32_t payload, uint32_t len) { if (len != 46 && len != 54) return false; if (!MATCH(payload, 0x40, 0x00, 0x00, 0x00)) return false; return true; } static inline bool match_second_life(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Haven't actually seen any legit 2-way SecondLife exchanges, so * only speculating based on my interpretation of the specs * * http://wiki.secondlife.com/wiki/Packet_Layout */ if (match_second_life_req(data->payload[0], data->payload_len[0])) { if (data->payload_len[1] == 0) return true; if (MATCH(data->payload[1], ANY, 0x00, 0x00, 0x00)) { if (data->payload_len[1] < 15) return false; return true; } } if (match_second_life_req(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] == 0) return true; if (MATCH(data->payload[0], ANY, 0x00, 0x00, 0x00)) { if (data->payload_len[0] < 15) return false; return true; } } return false; } static lpi_module_t lpi_second_life = { LPI_PROTO_UDP_SECONDLIFE, LPI_CATEGORY_GAMING, "SecondLife_UDP", 6, match_second_life }; void register_second_life_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_second_life, mod_map); } ================================================ FILE: lib/udp/lpi_serialnumberd.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_serialnumberd(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (MATCHSTR(data->payload[0], "SNQU")) { if (data->payload_len[1] == 0) return true; if (MATCHSTR(data->payload[1], "SNRE")) return true; } if (MATCHSTR(data->payload[1], "SNQU")) { if (data->payload_len[0] == 0) return true; if (MATCHSTR(data->payload[0], "SNRE")) return true; } return false; } static lpi_module_t lpi_serialnumberd = { LPI_PROTO_UDP_SERIALNUMBERD, LPI_CATEGORY_SERVICES, "Serialnumberd", 3, match_serialnumberd }; void register_serialnumberd(LPIModuleMap *mod_map) { register_protocol(&lpi_serialnumberd, mod_map); } ================================================ FILE: lib/udp/lpi_sip.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_sip_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_chars_either(data, 'S', 'I', 'P', ANY)) return true; if (match_str_either(data, "BYE ")) return true; if (match_str_either(data, "OPTI") && (data->payload_len[0] == 0 || data->payload_len[1] == 0)) return true; if (match_str_either(data, "INVI") && (data->payload_len[0] == 0 || data->payload_len[1] == 0)) return true; if (match_str_both(data, "NOTI", "OPTI")) return true; if (match_str_both(data, "OPTI", "REGI")) return true; if (match_str_both(data, "NOTI", "REGI")) return true; if (match_str_both(data, "NOTI", "INVI")) return true; if (match_str_either(data, "REGI") && (data->payload_len[0] == 0 || data->payload_len[1] == 0)) return true; if (match_str_either(data, "SUBS")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } return false; } static lpi_module_t lpi_sip_udp = { LPI_PROTO_UDP_SIP, LPI_CATEGORY_VOIP, "SIP_UDP", 2, match_sip_udp }; void register_sip_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_sip_udp, mod_map); } ================================================ FILE: lib/udp/lpi_skype.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_skype_rule1(lpi_data_t *data) { /* This is one method for matching skype traffic - turns out there * are other forms as well... */ /* The third byte is always 0x02 in Skype UDP traffic - if we have * payload in both directions we can probably match on that alone */ uint32_t payload0 = ntohl(data->payload[0]); uint32_t payload1 = ntohl(data->payload[1]); if (data->payload_len[0] > 0 && data->payload_len[1] > 0) { if ((payload0 & 0x0000ff00) != 0x00000200) return false; if ((payload1 & 0x0000ff00) != 0x00000200) return false; return true; } /* Probes with no responses are trickier - likelihood of a random * packet having 0x02 as the third byte is not small, so we'll try * and filter on packet size too */ if (data->payload_len[0] >= 18 && data->payload_len[0] <= 137 ) { if ((payload0 & 0x0000ff00) == 0x00000200) return true; } if (data->payload_len[1] >= 18 && data->payload_len[1] <= 137 ) { if ((payload1 & 0x0000ff00) == 0x00000200) return true; } return false; } static inline bool match_skype_U1(uint32_t payload, uint32_t len) { if (len < 18) return false; if ((ntohl(payload) & 0x0000ff00) == 0x00000200) return true; return false; } static inline bool match_skype_U2(uint32_t payload, uint32_t len) { if (len != 11) return false; if ((ntohl(payload) & 0x00000f00) == 0x00000500) return true; if ((ntohl(payload) & 0x00000f00) == 0x00000700) return true; return false; } static inline bool match_skype_rule2(lpi_data_t *data) { /* What we're looking for here is a initiating message (called U1) * matched with a response (called U2). * * The first two bytes of U1 and U2 must match. * * The third byte of U1 is always 0x02 (as with rule 1) * * The lower four bits of the third byte of U2 is always either 0x05 * or 0x07 * * The length of U2 is always 11 bytes. * * The length of U1 is always between 18 and 31 bytes. */ if ((ntohl(data->payload[0]) & 0xffff0000) != (ntohl(data->payload[1]) & 0xffff0000)) return false; if (match_skype_U1(data->payload[0], data->payload_len[0])) { if (match_skype_U2(data->payload[1], data->payload_len[1])) return true; } if (match_skype_U1(data->payload[1], data->payload_len[1])) { if (match_skype_U2(data->payload[0], data->payload_len[0])) return true; } return false; } static inline bool match_meeting_stun_request(uint32_t payload, uint32_t len) { if ((ntohl(payload) & 0xffff) != len - 4) return false; /* Checking for 0xff + ANY bytes is hard :( */ if ((ntohl(payload) & 0xff000000) != 0xff000000) return false; if (MATCH(payload, ANY, 0x10, ANY, ANY)) return true; return false; } static inline bool match_meeting_stun_reply(uint32_t payload, uint32_t len) { if ((ntohl(payload) & 0xffff) != len - 20) return false; if (MATCH(payload, 0x00, 0x01, ANY, ANY)) return true; if (MATCH(payload, 0x01, 0x01, ANY, ANY)) return true; return false; } static inline bool match_skype_meeting_broadcast(lpi_data_t *data) { /* This protocol is a LOT like STUN, but isn't really STUN. */ /* TODO get hold of skype for business and double check this */ if (match_meeting_stun_request(data->payload[0], data->payload_len[0])) { if (match_meeting_stun_reply(data->payload[1], data->payload_len[1])) { return true; } } if (match_meeting_stun_request(data->payload[1], data->payload_len[1])) { if (match_meeting_stun_reply(data->payload[0], data->payload_len[0])) { return true; } } return false; } static inline bool match_skype(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_skype_rule1(data)) return true; if (match_skype_rule2(data)) return true; if (match_skype_meeting_broadcast(data)) return true; return false; } static lpi_module_t lpi_skype = { LPI_PROTO_UDP_SKYPE, LPI_CATEGORY_VOIP, "Skype", 105, /* The Skype rules aren't strong, so have a low priority */ match_skype }; void register_skype(LPIModuleMap *mod_map) { register_protocol(&lpi_skype, mod_map); } ================================================ FILE: lib/udp/lpi_slp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_slp_req(uint32_t payload, uint32_t len) { /* According to RFC 2608, the 3rd and 4th bytes should be the * length (including the SLP header). This doesn't appear to be the * case with any of the port 427 traffic I've seen, so either I'm * wrong or people fail at following RFCs */ if (MATCH(payload, 0x02, 0x01, 0x00, 0x00) && len == 49) { return true; } return false; } static inline bool match_slp_resp(uint32_t payload, uint32_t len) { /* I haven't actually observed any responses yet, so just going * on what the spec says :/ */ if (len == 0) return true; if (MATCH(payload, 0x02, 0x02, ANY, ANY)) { return true; } return false; } static inline bool match_slp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 427 && data->client_port != 427) return false; if (match_slp_req(data->payload[0], data->payload_len[0])) { if (match_slp_resp(data->payload[1], data->payload_len[1])) return true; return false; } if (match_slp_req(data->payload[1], data->payload_len[1])) { if (match_slp_resp(data->payload[0], data->payload_len[0])) return true; return false; } return false; } static lpi_module_t lpi_slp = { LPI_PROTO_UDP_SLP, LPI_CATEGORY_SERVICES, "SLP", 5, match_slp }; void register_slp(LPIModuleMap *mod_map) { register_protocol(&lpi_slp, mod_map); } ================================================ FILE: lib/udp/lpi_smite.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_smite(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (MATCH(data->payload[0], 0x01, 0x14, 0x00, 0x00)) { if (MATCH(data->payload[1], 0x01, 0x14, 0x00, 0x00)) { return true; } } return false; } static lpi_module_t lpi_smite = { LPI_PROTO_UDP_SMITE, LPI_CATEGORY_GAMING, "Smite", 55, match_smite }; void register_smite(LPIModuleMap *mod_map) { register_protocol(&lpi_smite, mod_map); } ================================================ FILE: lib/udp/lpi_snapvpn.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_snap_query(uint32_t payload, uint32_t len) { if (MATCH(payload, '2', '7', '3', 'P') && len < 50) return true; return false; } static inline bool match_snap_fail(uint32_t payload, uint32_t len) { /* Saw this a lot when failing to connect to the server */ if (len == 14 && MATCH(payload, 0x0a, ANY, ANY, ANY)) return true; return false; } static inline bool match_snapvpn(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Ports 21, 25, 109, 119 */ if (match_snap_query(data->payload[0], data->payload_len[0])) { if (match_snap_query(data->payload[1], data->payload_len[1])) return true; if (match_snap_fail(data->payload[1], data->payload_len[1])) return true; } if (match_snap_query(data->payload[1], data->payload_len[1])) { if (match_snap_fail(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_snapvpn = { LPI_PROTO_UDP_SNAPVPN, LPI_CATEGORY_TUNNELLING, "SnapVPN", 25, match_snapvpn }; void register_snapvpn(LPIModuleMap *mod_map) { register_protocol(&lpi_snapvpn, mod_map); } ================================================ FILE: lib/udp/lpi_snmp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_snmp_payload(uint32_t payload, uint32_t len) { /* SNMP is BER encoded, which is an ass to decode */ uint8_t snmplen = 0; uint8_t *byte; if (len == 0) return true; /* Must be a SEQUENCE */ if (!MATCH(payload, 0x30, ANY, ANY, ANY)) return false; byte = ((uint8_t *)&payload) + 1; if (*byte< 0x80) { snmplen = *byte; if (!MATCH(payload, 0x30, ANY, 0x02, 0x01)) return false; if (len - 2 != snmplen) return false; return true; } if (*byte == 0x81) { snmplen = *(byte + 1); if (!MATCH(payload, 0x30, 0x81, ANY, 0x02)) return false; if (len - 3 != snmplen) return false; return true; } if (*byte == 0x82) { uint16_t longlen = *((uint16_t *)(byte + 1)); if (len - 4 != ntohs(longlen)) return false; return true; } return false; } static inline bool match_snmp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_snmp_payload(data->payload[0], data->payload_len[0])) return false; if (!match_snmp_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_snmp = { LPI_PROTO_UDP_SNMP, LPI_CATEGORY_MONITORING, "SNMP", 3, match_snmp }; void register_snmp(LPIModuleMap *mod_map) { register_protocol(&lpi_snmp, mod_map); } ================================================ FILE: lib/udp/lpi_sopcast.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_sopcast_req(uint32_t payload, uint32_t len) { if (MATCH(payload, 0xff, 0xff, 0x01, ANY)) { if (len == 52) return true; } return false; } static inline bool match_sopcast_reply(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x00, ANY, 0x02, ANY)) { if (len == 80) return true; } if (MATCH(payload, 0x00, ANY, 0x01, ANY)) { if (len == 60) return true; } return false; } static inline bool match_sopcast(lpi_data_t *data, lpi_module_t *mod UNUSED) { if ((data->payload[0] & 0xff000000) != (data->payload[1] & 0xff000000)) return false; if (match_sopcast_req(data->payload[0], data->payload_len[0])) { if (match_sopcast_reply(data->payload[1], data->payload_len[1])) return true; if (match_sopcast_req(data->payload[1], data->payload_len[1])) return true; } if (match_sopcast_req(data->payload[1], data->payload_len[1])) { if (match_sopcast_reply(data->payload[0], data->payload_len[0])) return true; if (match_sopcast_req(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_sopcast = { LPI_PROTO_UDP_SOPCAST, LPI_CATEGORY_P2PTV, "Sopcast", 5, match_sopcast }; void register_sopcast(LPIModuleMap *mod_map) { register_protocol(&lpi_sopcast, mod_map); } ================================================ FILE: lib/udp/lpi_spamfighter.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_spamfighter(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "DISC")) return true; if (match_str_either(data, "SCP\x03")) return true; return false; } static lpi_module_t lpi_spamfighter = { LPI_PROTO_UDP_SPAMFIGHTER, LPI_CATEGORY_ANTISPAM, "SpamFighter", 3, match_spamfighter }; void register_spamfighter(LPIModuleMap *mod_map) { register_protocol(&lpi_spamfighter, mod_map); } ================================================ FILE: lib/udp/lpi_spotify_bcast.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Protocol used by Spotify to find other clients on the local network */ static inline bool match_spotify_bcast(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_str_either(data, "Spot")) return false; if (data->server_port != 57621 || data->client_port != 57621) return false; return true; } static lpi_module_t lpi_spotify_bcast = { LPI_PROTO_UDP_SPOTIFY_BROADCAST, LPI_CATEGORY_BROADCAST, "SpotifyBroadcast", 14, match_spotify_bcast }; void register_spotify_bcast(LPIModuleMap *mod_map) { register_protocol(&lpi_spotify_bcast, mod_map); } ================================================ FILE: lib/udp/lpi_sql_worm.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_sql_worm(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* The recipient does not reply (with any luck!) */ if (data->payload_len[0] > 0 && data->payload_len[1] > 0) return false; if (match_chars_either(data, 0x04, 0x01, 0x01, 0x01)) return true; return false; } static lpi_module_t lpi_sql_worm = { LPI_PROTO_UDP_SQLEXP, LPI_CATEGORY_MALWARE, "SQLExp", 10, match_sql_worm }; void register_sql_worm(LPIModuleMap *mod_map) { register_protocol(&lpi_sql_worm, mod_map); } ================================================ FILE: lib/udp/lpi_ssdp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ssdp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "M-SE")) return true; if (match_str_either(data, "NOTI")) { if (data->server_port != 1900) return false; if (data->client_port != 1900) return false; return true; } /* Check for SSDP reflection attacks */ if (match_str_either(data, "HTTP")) { /* usually only the source port is 1900 */ if (data->server_port != 1900 && data->client_port != 1900) return false; /* the request usually has a spoofed address so we won't * payload in one direction */ if (data->payload_len[0] != 0 && data->payload_len[0] != 0) return false; return true; } return false; } static lpi_module_t lpi_ssdp = { LPI_PROTO_UDP_SSDP, LPI_CATEGORY_SERVICES, "SSDP", 5, match_ssdp }; void register_ssdp(LPIModuleMap *mod_map) { register_protocol(&lpi_ssdp, mod_map); } ================================================ FILE: lib/udp/lpi_starcitizen.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_sc_13(uint32_t payload, uint32_t len) { if (len == 13 && MATCH(payload, 0x43, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_sc_67(uint32_t payload, uint32_t len) { if (len == 67 && MATCH(payload, 0x43, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_starcitizen(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 64090 */ if (match_sc_13(data->payload[0], data->payload_len[0])) { if (match_sc_13(data->payload[1], data->payload_len[1])) return true; if (match_sc_67(data->payload[1], data->payload_len[1])) return true; } if (match_sc_13(data->payload[1], data->payload_len[1])) { if (match_sc_67(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_starcitizen = { LPI_PROTO_UDP_STARCITIZEN, LPI_CATEGORY_GAMING, "StarCitizen", 39, match_starcitizen }; void register_starcitizen(LPIModuleMap *mod_map) { register_protocol(&lpi_starcitizen, mod_map); } ================================================ FILE: lib/udp/lpi_starcraft.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_sc_message(uint32_t payload, uint32_t len) { /* http://forum.valhallalegends.com/index.php?topic=17702.0 */ /* Starcraft header is 16 bytes - most bodies are either one or * two bytes */ if (MATCH(payload, 0x00, 0x00, 0x00, 0x00) && len == 16) return true; if (MATCH(payload, 0x00, 0x00, 0x00, 0x00) && len == 17) return true; if (MATCH(payload, 0x00, 0x00, 0x00, 0x00) && len == 18) return true; /* 34 also seems possible */ if (MATCH(payload, 0x00, 0x00, 0x00, 0x00) && len == 34) return true; return false; } static inline bool match_sc_remaster_01(uint32_t payload, uint32_t len) { /* New protocol that has been implemented as part of the * remaster. */ if (len == 0) return true; if (len < 50 && MATCH(payload, 0x08, 0x01, 0x12, 0x14)) return true; if (len < 50 && MATCH(payload, 0x08, 0x01, 0x12, 0x10)) return true; if (len < 50 && MATCH(payload, 0x08, 0x01, 0x12, 0x11)) return true; return false; } static inline bool match_sc_remaster_02(uint32_t payload, uint32_t len) { /* New protocol that has been implemented as part of the * remaster. */ if (len < 50 && MATCH(payload, 0x08, 0x02, 0x12, 0x18)) return true; return false; } static inline bool match_starcraft(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 6112 && data->client_port != 6112) return false; if (match_sc_remaster_01(data->payload[0], data->payload_len[0])) { if (match_sc_remaster_01(data->payload[1], data->payload_len[1])) return true; if (match_sc_remaster_02(data->payload[1], data->payload_len[1])) return true; } if (match_sc_remaster_01(data->payload[1], data->payload_len[1])) { if (match_sc_remaster_01(data->payload[0], data->payload_len[0])) return true; if (match_sc_remaster_02(data->payload[0], data->payload_len[0])) return true; } if (!match_sc_message(data->payload[0], data->payload_len[0])) return false; if (!match_sc_message(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_starcraft = { LPI_PROTO_UDP_STARCRAFT, LPI_CATEGORY_GAMING, "Starcraft", 4, match_starcraft }; void register_starcraft(LPIModuleMap *mod_map) { register_protocol(&lpi_starcraft, mod_map); } ================================================ FILE: lib/udp/lpi_starleaf.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_slp(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x00, 0x00, 0x00, 0x00) && len == 9) return true; return false; } static inline bool match_starleaf(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Restrict to port 24704 */ if (data->server_port != 24704 && data->client_port != 24704) return false; if (match_slp(data->payload[0], data->payload_len[0])) { if (match_slp(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_starleaf = { LPI_PROTO_UDP_STARLEAF, LPI_CATEGORY_VOIP, "StarLeaf", 122, match_starleaf }; void register_starleaf(LPIModuleMap *mod_map) { register_protocol(&lpi_starleaf, mod_map); } ================================================ FILE: lib/udp/lpi_steam.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_39_request(uint32_t payload, uint32_t len) { if (len != 4) return false; if (!MATCH(payload, 0x39, 0x18, 0x00, 0x00)) return false; return true; } static inline bool match_3a_response(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len != 8) return false; if (!MATCH(payload, 0x3a, 0x18, 0x00, 0x00)) return false; return true; } static inline bool match_steam_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Master Server Queries begin with 31 ff 30 2e * * NOTE: the ff byte can vary depending on the region that the user * is querying for, but ff is the "all regions" option and is the * typical default. */ if (match_str_either(data, "\x31\xff\x30\x2e") && match_str_either(data, "\xff\xff\xff\xff")) { return true; } /* Server Info queries are always 53 bytes and begin with ff ff ff ff. * The reply also begins with ff ff ff ff but can vary in size */ if (MATCHSTR(data->payload[0], "\xff\xff\xff\xff") && data->payload_len[0] == 25 && (MATCHSTR(data->payload[1], "\xff\xff\xff\xff") || data->payload_len[1] == 0)) { return true; } if (MATCHSTR(data->payload[1], "\xff\xff\xff\xff") && data->payload_len[1] == 25 && (MATCHSTR(data->payload[0], "\xff\xff\xff\xff") || data->payload_len[0] == 0)) { return true; } /* This stuff is definitely related to Steam or some game played * over Steam - need to look into this more at some point */ if (match_39_request(data->payload[0], data->payload_len[0])) { if (match_3a_response(data->payload[1], data->payload_len[1])) return true; } if (match_39_request(data->payload[1], data->payload_len[1])) { if (match_3a_response(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_steam_udp = { LPI_PROTO_UDP_STEAM, LPI_CATEGORY_GAMING, "Steam_UDP", 4, match_steam_udp }; void register_steam_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_steam_udp, mod_map); } ================================================ FILE: lib/udp/lpi_steam_inhomebroadcast.cc ================================================ /* * This file is part of libprotoident * * Copyright (c) 2011 The University of Waikato, Hamilton, New Zealand. * Author: Shane Alcock * * With contributions from: * Aaron Murrihy * Donald Neal * * All rights reserved. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with libprotoident; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id$ */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_steam_inhomebroadcast_ports(uint16_t porta, uint16_t portb) { if (porta == 27036 && portb == 27036) return true; return false; } static inline bool match_steam_inhomebroadcast(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_steam_inhomebroadcast_ports(data->server_port, data->client_port)) return false; if (data->payload_len[0] == 0 || data->payload_len[1] == 0) { if (match_str_both(data, "\xff\xff\xff\xff", "\x00\x00\x00\x00")) return true; } return false; } static lpi_module_t lpi_steam_inhomebroadcast = { LPI_PROTO_UDP_STEAM_INHOMEBROADCAST, LPI_CATEGORY_GAMING, "Steam_InHome_Broadcast", 9, match_steam_inhomebroadcast }; void register_steam_inhomebroadcast(LPIModuleMap *mod_map) { register_protocol(&lpi_steam_inhomebroadcast, mod_map); } ================================================ FILE: lib/udp/lpi_steam_localbroadcast.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* This protocol is something I observed on a laptop running a Steam client. * It just constantly spams 255.255.255.255 with these packets and I found * some references to Steam when trying to find out what it was, e.g. * http://ask.wireshark.org/questions/11566/possible-malware-on-network * */ static inline bool match_steam_ports(uint16_t port_a, uint16_t port_b) { if (port_a == 10007 || port_b == 10007) return true; if (port_a == 10019 || port_b == 10019) return true; return false; } static inline bool match_steam_request(uint32_t payload, uint32_t len) { if (len != 128) return false; if (MATCHSTR(payload, "\x00\xff\x00\x00")) return true; if (MATCHSTR(payload, "\xf0\xff\x00\x00")) return true; return false; } static inline bool match_steam_reply(uint32_t payload, uint32_t len) { /* Not seen a valid reply yet, so just check for no reply */ if (len == 0) return true; return false; } static inline bool match_steam_localbroadcast(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!match_steam_ports(data->server_port, data->client_port)) { return false; } if (match_steam_request(data->payload[0], data->payload_len[0])) { if (match_steam_reply(data->payload[1], data->payload_len[1])) return true; } if (match_steam_request(data->payload[1], data->payload_len[1])) { if (match_steam_reply(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_steam_localbroadcast = { LPI_PROTO_UDP_STEAM_LOCALBROADCAST, LPI_CATEGORY_BROADCAST, "SteamLocalBroadcast", 16, match_steam_localbroadcast }; void register_steam_localbroadcast(LPIModuleMap *mod_map) { register_protocol(&lpi_steam_localbroadcast, mod_map); } ================================================ FILE: lib/udp/lpi_steamfriends.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_steamfriends(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, "VS01")) return true; return false; } static lpi_module_t lpi_steamfriends = { LPI_PROTO_UDP_STEAM_FRIENDS, LPI_CATEGORY_GAMING, "Steam_Friends", 3, match_steamfriends }; void register_steamfriends(LPIModuleMap *mod_map) { register_protocol(&lpi_steamfriends, mod_map); } ================================================ FILE: lib/udp/lpi_storm_worm.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_storm_worm(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This pattern is observed on ports 4000, 7871 and 11271 which are * all known port numbers for this trojan */ if (MATCH(data->payload[0], 0xe3, 0x1b, 0xd6, 0x21)) { if (data->payload_len[0] != 4) return false; if (data->payload_len[1] == 0) return true; if (MATCH(data->payload[1], 0xe3, 0x0c, 0x66, 0xe6)) return true; } if (MATCH(data->payload[1], 0xe3, 0x1b, 0xd6, 0x21)) { if (data->payload_len[1] != 4) return false; if (data->payload_len[0] == 0) return true; if (MATCH(data->payload[0], 0xe3, 0x0c, 0x66, 0xe6)) return true; } return false; } static lpi_module_t lpi_storm_worm = { LPI_PROTO_UDP_STORM_WORM, LPI_CATEGORY_MALWARE, "StormWorm", 10, match_storm_worm }; void register_storm_worm(LPIModuleMap *mod_map) { register_protocol(&lpi_storm_worm, mod_map); } ================================================ FILE: lib/udp/lpi_stun.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static bool match_facetime_stun_request(uint32_t payload, uint32_t len) { /* Bytes 3 and 4 are the Message Length - the STUN header */ if ((ntohl(payload) & 0x0000ffff) != len - 20) return false; if (MATCH(payload, 0x0f, 0xe0, ANY, ANY)) return true; if (MATCH(payload, 0x0f, 0xe1, ANY, ANY)) return true; if (MATCH(payload, 0x0f, 0xe4, ANY, ANY)) return true; return false; } static bool match_facetime_stun_response(uint32_t payload, uint32_t len) { /* Bytes 3 and 4 are the Message Length - the STUN header */ if ((ntohl(payload) & 0x0000ffff) != len - 20) return false; if (MATCH(payload, 0x0e, 0xe0, ANY, ANY)) return true; if (MATCH(payload, 0x0e, 0xe1, ANY, ANY)) return true; if (MATCH(payload, 0x0e, 0xe4, ANY, ANY)) return true; return false; } static bool match_skype_stun_request(uint32_t payload, uint32_t len) { /* Bytes 3 and 4 are the Message Length - the STUN header */ if ((ntohl(payload) & 0x0000ffff) != len - 20) return false; /* These flows start with an Allocate Request */ if (MATCH(payload, 0x00, 0x03, ANY, ANY)) return true; return false; } static bool match_stun_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; /* Bytes 3 and 4 are the Message Length - the STUN header */ if ((ntohl(payload) & 0x0000ffff) != len - 20) return false; if (MATCH(payload, 0x00, 0x01, ANY, ANY)) return true; if (MATCH(payload, 0x01, 0x01, ANY, ANY)) return true; if (MATCH(payload, 0x01, 0x11, ANY, ANY)) return true; if (MATCH(payload, 0x00, 0x03, ANY, ANY)) return true; if (MATCH(payload, 0x01, 0x03, ANY, ANY)) return true; if (MATCH(payload, 0x01, 0x13, ANY, ANY)) return true; /* Data Indication message (used by Skype) */ if (MATCH(payload, 0x01, 0x15, ANY, ANY)) return true; return false; } static inline bool match_stun(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This seems to be a special response containing a STUN token * * Not very well-documented though :( */ if (match_str_either(data, "RSP/")) return true; if (match_stun_payload(data->payload[0], data->payload_len[0])) { if (match_stun_payload(data->payload[1], data->payload_len[1])) return true; } if (match_facetime_stun_request(data->payload[0], data->payload_len[0])) { if ((data->payload[0] & 0xff0000) == (data->payload[1] & 0xff0000) && match_facetime_stun_response(data->payload[1], data->payload_len[1])) { return true; } } if (match_facetime_stun_request(data->payload[1], data->payload_len[1])) { /* Byte 2 must match for both directions */ if ((data->payload[0] & 0xff0000) == (data->payload[1] & 0xff0000) && match_facetime_stun_response(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_stun = { LPI_PROTO_UDP_STUN, LPI_CATEGORY_NAT, "STUN", 3, match_stun }; void register_stun(LPIModuleMap *mod_map) { register_protocol(&lpi_stun, mod_map); } ================================================ FILE: lib/udp/lpi_syslog.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_syslog_payload(uint32_t pload) { /* Syslog starts with , where PRI is a number between 0 and 191 */ if (MATCH(pload, '<', ANY, '>', ANY)) return true; if (MATCH(pload, '<', ANY, ANY, '>')) return true; if (MATCH(pload, '<', '1', ANY, ANY)) return true; return false; } static inline bool match_syslog(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 514 && data->client_port != 514) return false; if (data->payload_len[0] == 0) { if (match_syslog_payload(data->payload[1])) return true; } if (data->payload_len[1] == 0) { if (match_syslog_payload(data->payload[0])) return true; } return false; } static lpi_module_t lpi_syslog = { LPI_PROTO_UDP_SYSLOG, LPI_CATEGORY_LOGGING, "Syslog", 6, match_syslog }; void register_syslog(LPIModuleMap *mod_map) { register_protocol(&lpi_syslog, mod_map); } ================================================ FILE: lib/udp/lpi_talesrunner_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_tr_1b(uint32_t payload, uint32_t len) { if (len == 8 && MATCH(payload, 0x1b, 0x00, 0xb2, 0x1a)) return true; return false; } static inline bool match_tr_1e(uint32_t payload, uint32_t len) { if (len == 8 && MATCH(payload, 0x1e, 0x00, 0x6b, 0x51)) return true; return false; } static inline bool match_talesrunner_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (MATCH(data->payload[0], 0x1d, 0x00, 0x67, 0x01)) { if (MATCH(data->payload[1], 0x1d, 0x00, 0x61, 0x01)) { /* One of the packets is always 8 bytes */ if (data->payload_len[0] == 8 || data->payload_len[1] == 8) { return true; } } } if (match_tr_1b(data->payload[0], data->payload_len[0])) { if (match_tr_1b(data->payload[1], data->payload_len[1])) return true; } if (match_tr_1e(data->payload[0], data->payload_len[0])) { if (match_tr_1e(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_talesrunner_udp = { LPI_PROTO_UDP_TALESRUNNER, LPI_CATEGORY_GAMING, "TalesrunnerUDP", 59, match_talesrunner_udp }; void register_talesrunner_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_talesrunner_udp, mod_map); } ================================================ FILE: lib/udp/lpi_teamspeak.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ts3_req(uint32_t payload, uint32_t len) { if (MATCH(payload, 'T', 'S', '3', 'I')) return true; return false; } static inline bool match_ts3_resp(uint32_t payload, uint32_t len, uint16_t porta, uint16_t portb) { if (len == 0) return true; if (MATCH(payload, 'T', 'S', '3', 'I')) return true; /* Seem to get some encrypted responses, but the only ones I've * seen so far are either 181 or 182 bytes. Enforce the expected * TeamSpeak port in this case, just to be safe. */ if ((len >= 180 && len <= 182) && (porta == 9987 || portb == 9987)) return true; return false; } static inline bool match_teamspeak(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Teamspeak version 2 */ if (match_str_both(data, "\xf4\xbe\x03\x00", "\xf4\xbe\x03\x00")) return true; /* Teamspeak version 3 */ if (match_ts3_req(data->payload[0], data->payload_len[0])) { if (match_ts3_resp(data->payload[1], data->payload_len[1], data->server_port, data->client_port)) return true; } if (match_ts3_req(data->payload[1], data->payload_len[1])) { if (match_ts3_resp(data->payload[0], data->payload_len[0], data->server_port, data->client_port)) return true; } /* Not sure what this is, but it goes to a teamspeak.org server */ if (match_str_either(data, "\x07Pri")) return true; return false; } static lpi_module_t lpi_teamspeak = { LPI_PROTO_UDP_TEAMSPEAK, LPI_CATEGORY_VOIP, "TeamSpeak", 3, match_teamspeak }; void register_teamspeak(LPIModuleMap *mod_map) { register_protocol(&lpi_teamspeak, mod_map); } ================================================ FILE: lib/udp/lpi_teamviewer.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_tv_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len != 88) return false; if (!MATCH(payload, ANY, ANY, ANY, 0x17)) return false; return true; } static inline bool match_teamviewer_classic_udp(lpi_data_t *data) { if (!match_tv_payload(data->payload[0], data->payload_len[0])) return false; if (!match_tv_payload(data->payload[1], data->payload_len[1])) return false; return true; } static inline bool match_teamviewer_96(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len == 96 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_tv_1024(uint32_t payload, uint32_t len) { if (len == 1024 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_tv_48(uint32_t payload, uint32_t len) { if (len == 48 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_teamviewer_udp(lpi_data_t *data, lpi_module_t *module UNUSED) { if (match_teamviewer_classic_udp(data)) return true; if (match_teamviewer_96(data->payload[0], data->payload_len[0])) { if (match_teamviewer_96(data->payload[1], data->payload_len[1])) return true; } if (data->server_port == 5938 || data->client_port == 5938) { if (match_tv_1024(data->payload[0], data->payload_len[0])) { if (match_tv_48(data->payload[1], data->payload_len[1])) return true; } if (match_tv_1024(data->payload[1], data->payload_len[1])) { if (match_tv_48(data->payload[0], data->payload_len[0])) return true; } } return false; } static lpi_module_t lpi_teamviewer = { LPI_PROTO_UDP_TEAMVIEWER, LPI_CATEGORY_REMOTE, "TeamViewer_UDP", 115, match_teamviewer_udp }; void register_teamviewer_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_teamviewer, mod_map); } ================================================ FILE: lib/udp/lpi_teredo.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static bool match_teredo_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (MATCH(payload, 0x00, 0x01, 0x00, 0x00)) { if (len == 61 || len == 109 || len == 77) return true; } /* Matching v6 traffic */ if (MATCH(payload, 0x60, 0x00, 0x00, 0x00) && len >= 4) { return true; } /* We also see this in flows that have the same 5 tuple as other * Teredo flows */ if (MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return false; if (len == 48 && MATCH(payload, 0x00, 0x00, ANY, ANY)) return true; return false; } static inline bool match_teredo(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port == 53 || data->client_port == 53) { if (data->payload_len[0] == 0) return false; if (data->payload_len[1] == 0) return false; } if (!match_teredo_payload(data->payload[0], data->payload_len[0])) return false; if (!match_teredo_payload(data->payload[1], data->payload_len[1])) return false; return true; } static lpi_module_t lpi_teredo = { LPI_PROTO_UDP_TEREDO, LPI_CATEGORY_TUNNELLING, "Teredo", 6, match_teredo }; void register_teredo(LPIModuleMap *mod_map) { register_protocol(&lpi_teredo, mod_map); } ================================================ FILE: lib/udp/lpi_tf2.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_tf2_20(uint32_t payload, uint32_t len) { if (len == 20 && MATCHSTR(payload, "\xff\xff\xff\xff")) return true; return false; } static inline bool match_tf2_39(uint32_t payload, uint32_t len) { if (len == 39 && MATCHSTR(payload, "\xff\xff\xff\xff")) return true; return false; } static inline bool is_okport(lpi_data_t *data) { if (data->server_port == 27015 && data->client_port == 27015) return true; if (data->server_port == 27005 || data->client_port == 27005) return true; return false; } static inline bool match_tf2(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!is_okport(data)) return false; if (match_tf2_20(data->payload[0], data->payload_len[0])) { if (match_tf2_39(data->payload[1], data->payload_len[1])) return true; } if (match_tf2_20(data->payload[1], data->payload_len[1])) { if (match_tf2_39(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_tf2 = { LPI_PROTO_UDP_TF2, LPI_CATEGORY_GAMING, "TeamFortress2", 100, match_tf2 }; void register_tf2(LPIModuleMap *mod_map) { register_protocol(&lpi_tf2, mod_map); } ================================================ FILE: lib/udp/lpi_tftp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_tftp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Read request */ if (MATCH(data->payload[0], 0x00, 0x01, ANY, ANY)) { if (data->server_port != 69 && data->client_port != 69) return false; if (data->payload_len[1] == 0) return true; if (MATCH(data->payload[1], 0x00, 0x03, ANY, ANY)) return true; if (MATCH(data->payload[1], 0x00, 0x05, ANY, ANY)) return true; } if (MATCH(data->payload[1], 0x00, 0x01, ANY, ANY)) { if (data->server_port != 69 && data->client_port != 69) return false; if (data->payload_len[0] == 0) return true; if (MATCH(data->payload[0], 0x00, 0x03, ANY, ANY)) return true; if (MATCH(data->payload[0], 0x00, 0x05, ANY, ANY)) return true; } /* Write request */ if (MATCH(data->payload[0], 0x00, 0x02, ANY, ANY)) { if (data->server_port != 69 && data->client_port != 69) return false; if (data->payload_len[1] == 0) return true; if (MATCH(data->payload[1], 0x00, 0x04, ANY, ANY)) return true; if (MATCH(data->payload[1], 0x00, 0x05, ANY, ANY)) return true; } if (MATCH(data->payload[1], 0x00, 0x02, ANY, ANY)) { if (data->server_port != 69 && data->client_port != 69) return false; if (data->payload_len[0] == 0) return true; if (MATCH(data->payload[0], 0x00, 0x04, ANY, ANY)) return true; if (MATCH(data->payload[0], 0x00, 0x05, ANY, ANY)) return true; } /* Some systems will switch to a different port for the file * transfer itself, so the request is in a different flow */ if (MATCH(data->payload[0], 0x00, 0x03, 0x00, 0x01)) { if (data->payload_len[1] == 0) return true; if (MATCH(data->payload[1], 0x00, 0x05, ANY, ANY)) return true; /* Acks (0x04) must be 4 bytes */ if (data->payload_len[1] != 4) return false; if (MATCH(data->payload[1], 0x00, 0x04, 0x00, 0x01)) return true; } if (MATCH(data->payload[1], 0x00, 0x03, 0x00, 0x01)) { if (data->payload_len[0] == 0) return true; if (MATCH(data->payload[0], 0x00, 0x05, ANY, ANY)) return true; /* Acks (0x04) must be 4 bytes */ if (data->payload_len[0] != 4) return false; if (MATCH(data->payload[0], 0x00, 0x04, 0x00, 0x01)) return true; } return false; } static lpi_module_t lpi_tftp = { LPI_PROTO_UDP_TFTP, LPI_CATEGORY_FILES, "TFTP", 5, match_tftp }; void register_tftp(LPIModuleMap *mod_map) { register_protocol(&lpi_tftp, mod_map); } ================================================ FILE: lib/udp/lpi_thecrew.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_thecrew_hello(uint32_t payload, uint32_t len) { if (MATCHSTR(payload, "\xff\xff\xff\xff")) { if (len == 50) return true; if (len == 39) return true; if (len == 60) return true; } return false; } static inline bool match_thecrew(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 3001 && data->client_port != 3001 && data->server_port != 10000 && data->client_port != 10000) { return false; } if (match_thecrew_hello(data->payload[0], data->payload_len[0])) { if (match_thecrew_hello(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_thecrew = { LPI_PROTO_UDP_THE_CREW, LPI_CATEGORY_GAMING, "TheCrew", 75, match_thecrew }; void register_thecrew(LPIModuleMap *mod_map) { register_protocol(&lpi_thecrew, mod_map); } ================================================ FILE: lib/udp/lpi_thq.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_thq(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* I *suspect* this is the protocol used by RTS games released by * THQ - haven't been able to confirm for sure, though * * Most traffic is on port 6112, which is used by Blizzard and THQ * games, but we already have rules for most Blizzard stuff */ /* The ANY byte also matches the packet length - 17, if we need * further matching rules */ if (data->payload_len[0] != 0 && !MATCH(data->payload[0], 'Q', 'N', 'A', ANY)) return false; if (data->payload_len[1] != 0 && !MATCH(data->payload[1], 'Q', 'N', 'A', ANY)) return false; return true; } static lpi_module_t lpi_thq = { LPI_PROTO_UDP_THQ, LPI_CATEGORY_GAMING, "THQ", 3, match_thq }; void register_thq(LPIModuleMap *mod_map) { register_protocol(&lpi_thq, mod_map); } ================================================ FILE: lib/udp/lpi_torchlight2.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_tl2_00(uint32_t payload, uint32_t len) { if (len == 13 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_tl2_01(uint32_t payload, uint32_t len) { if (len == 13 && MATCH(payload, 0x01, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_torchlight2(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_tl2_00(data->payload[0], data->payload_len[0])) { if (match_tl2_01(data->payload[1], data->payload_len[1])) return true; } if (match_tl2_00(data->payload[1], data->payload_len[1])) { if (match_tl2_01(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_torchlight2 = { LPI_PROTO_UDP_TORCHLIGHT2, LPI_CATEGORY_GAMING, "Torchlight2", 201, match_torchlight2 }; void register_torchlight2(LPIModuleMap *mod_map) { register_protocol(&lpi_torchlight2, mod_map); } ================================================ FILE: lib/udp/lpi_tox.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Open source encrypted skype replacement */ static inline bool match_tox_get(uint32_t payload, uint32_t len) { if (len == 113 && MATCH(payload, 0x02, ANY, ANY, ANY)) return true; return false; } static inline bool match_tox_reply(uint32_t payload, uint32_t len) { /* Not sure on these length restrictions */ if (len == 238 && MATCH(payload, 0x04, ANY, ANY, ANY)) return true; if (len == 354 && MATCH(payload, 0x83, ANY, ANY, ANY)) return true; if (len == 387 && MATCH(payload, 0x82, ANY, ANY, ANY)) return true; return false; } static inline bool match_tox(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 33445 && data->client_port != 33445) { return false; } if (match_tox_get(data->payload[0], data->payload_len[0])) { if (match_tox_reply(data->payload[1], data->payload_len[1])) { return true; } } if (match_tox_get(data->payload[1], data->payload_len[1])) { if (match_tox_reply(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_tox = { LPI_PROTO_UDP_TOX, LPI_CATEGORY_CHAT, "ToxUDP", 110, match_tox }; void register_tox(LPIModuleMap *mod_map) { register_protocol(&lpi_tox, mod_map); } ================================================ FILE: lib/udp/lpi_traceroute.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ea_traceroute(uint32_t payload, uint32_t len) { if (len != 42) return false; if (!MATCH(payload, 'P', 'a', 't', 'h')) return false; return true; } static inline bool match_planetlab_traceroute(uint32_t payload, uint32_t len) { if (len != 82) return false; if (!MATCH(payload, '@', 'A', 'B', 'C')) return false; return true; } static inline bool match_traceroute(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* The iVMG people put payload in their traceroute packets that * we can easily identify */ if (match_str_either(data, "iVMG")) return true; /* Spammy traceroute observed coming from EA servers */ if (match_ea_traceroute(data->payload[0], data->payload_len[0])) { if (data->payload_len[1] == 0) return true; } if (match_ea_traceroute(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] == 0) return true; } /* This seems to be a traceroute sent from planetlab nodes */ if (match_planetlab_traceroute(data->payload[0], data->payload_len[0])) { if (data->payload_len[1] == 0) return true; } if (match_planetlab_traceroute(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] == 0) return true; } if (data->payload_len[0] == 0) { if (!MATCH(data->payload[1], ANY, ANY, 0x00, 0x00)) return false; if (data->payload_len[1] != 16 && data->payload_len[1] != 8) return false; if (data->server_port != 33435 && data->client_port != 33435) return false; return true; } if (data->payload_len[1] == 0) { if (!MATCH(data->payload[0], ANY, ANY, 0x00, 0x00)) return false; if (data->payload_len[0] != 16 && data->payload_len[1] != 8) return false; if (data->server_port != 33435 && data->client_port != 33435) return false; return true; } return false; } static lpi_module_t lpi_traceroute = { LPI_PROTO_UDP_TRACEROUTE, LPI_CATEGORY_MONITORING, "Traceroute_UDP", 2, match_traceroute }; void register_traceroute(LPIModuleMap *mod_map) { register_protocol(&lpi_traceroute, mod_map); } ================================================ FILE: lib/udp/lpi_tremulous.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_tremulous(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (!MATCH(data->payload[0], 0xff, 0xff, 0xff, 0xff)) { if (data->payload_len[0] != 0) return false; } if (!MATCH(data->payload[1], 0xff, 0xff, 0xff, 0xff)) { if (data->payload_len[1] != 0) return false; } /* Not super confident that this won't match other traffic, so * added a port rule here */ if (data->server_port != 30710 && data->client_port != 30710 && data->client_port != 30711 && data->server_port != 30711) { return false; } if (data->payload_len[0] >= 20 && data->payload_len[0] <= 24) { if (data->payload_len[1] == 0) return true; } if (data->payload_len[1] >= 20 && data->payload_len[1] <= 24) { if (data->payload_len[0] == 0) return true; } if (data->payload_len[0] >= 116 && data->payload_len[0] <= 119) { if (data->payload_len[1] == 0) return true; } if (data->payload_len[1] >= 116 && data->payload_len[1] <= 119) { if (data->payload_len[0] == 0) return true; } if (data->payload_len[0] == 37) { if (data->payload_len[1] == 98) return true; } if (data->payload_len[1] == 37) { if (data->payload_len[0] == 98) return true; } return false; } static lpi_module_t lpi_tremulous = { LPI_PROTO_UDP_TREMULOUS, LPI_CATEGORY_GAMING, "Tremulous", 7, match_tremulous }; void register_tremulous(LPIModuleMap *mod_map) { register_protocol(&lpi_tremulous, mod_map); } ================================================ FILE: lib/udp/lpi_turbovpn.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_gene(uint32_t payload, uint32_t len) { /* Range of packet sizes, but always fairly small */ if (MATCH(payload, 'G', 'E', 'N', 'E')) { if (len >= 15 && len <= 50) return true; } return false; } static inline bool match_turbovpn(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_gene(data->payload[0], data->payload_len[0])) { if (match_gene(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_turbovpn = { LPI_PROTO_UDP_TURBOVPN, LPI_CATEGORY_TUNNELLING, "TurboVPN", 10, match_turbovpn }; void register_turbovpn(LPIModuleMap *mod_map) { register_protocol(&lpi_turbovpn, mod_map); } ================================================ FILE: lib/udp/lpi_tvants.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_tvants(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "\x04\x00\x05\x00", "\x04\x00\x05\x00")) return true; if (match_str_both(data, "\x04\x00\x07\x00", "\x04\x00\x05\x00")) return true; return false; } static lpi_module_t lpi_tvants = { LPI_PROTO_UDP_TVANTS, LPI_CATEGORY_P2PTV, "TVants", 5, match_tvants }; void register_tvants(LPIModuleMap *mod_map) { register_protocol(&lpi_tvants, mod_map); } ================================================ FILE: lib/udp/lpi_ubisoft_games.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* A variety of Ubisoft games seem to use a similar protocol for * multiplayer. Usually seen on UDP port 3074, but not always. */ static inline bool match_ubisoft_pat(uint32_t payload, uint32_t len) { if (len == 71 && MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_ubisoft_games(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_ubisoft_pat(data->payload[0], data->payload_len[0])) { if (match_ubisoft_pat(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_ubisoft_games = { LPI_PROTO_UDP_UBISOFT_GAMES, LPI_CATEGORY_GAMING, "UbisoftGames", 199, match_ubisoft_games }; void register_ubisoft_games(LPIModuleMap *mod_map) { register_protocol(&lpi_ubisoft_games, mod_map); } ================================================ FILE: lib/udp/lpi_umeye.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Umeye itself seems to be a cloud platform for streaming, but it seems * to be most commonly used in concert with home surveillance cameras * to allow users to check their cameras remotely. */ static inline bool match_umeye_shake(uint32_t payload, uint32_t len) { if (len == 164 && MATCHSTR(payload, "\xc1\xef\xab\xff")) return true; return false; } static inline bool match_umeye(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_umeye_shake(data->payload[0], data->payload_len[0])) { if (match_umeye_shake(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_umeye = { LPI_PROTO_UDP_UMEYE, LPI_CATEGORY_IPCAMERAS, "Umeye", 101, match_umeye }; void register_umeye(LPIModuleMap *mod_map) { register_protocol(&lpi_umeye, mod_map); } ================================================ FILE: lib/udp/lpi_unreal.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_unreal_query(uint32_t payload, uint32_t len) { /* UT2004 retail is 0x80, demo is 0x7f */ /* Queries are 5 bytes */ if (len != 5) return false; if (MATCH(payload, 0x80, 0x00, 0x00, 0x00)) return true; if (MATCH(payload, 0x7f, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_unreal(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* http://www.unrealadmin.org/forums/showthread.php?p=56944 */ if (match_unreal_query(data->payload[0], data->payload_len[0])) { if (MATCH(data->payload[1], 0x80, 0x00, 0x00, 0x00)) return true; if (data->payload_len[1] == 0) return true; } if (match_unreal_query(data->payload[1], data->payload_len[1])) { if (MATCH(data->payload[0], 0x80, 0x00, 0x00, 0x00)) return true; if (data->payload_len[0] == 0) return true; } return false; } static lpi_module_t lpi_unreal = { LPI_PROTO_UDP_UNREAL, LPI_CATEGORY_GAMING, "Unreal", 5, match_unreal }; void register_unreal(LPIModuleMap *mod_map) { register_protocol(&lpi_unreal, mod_map); } ================================================ FILE: lib/udp/lpi_ventrilo.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_ventrilo(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* We see this on port 6100, so I'm assuming it is the UDP * Ventrilo protocol. No real documentation of it to confirm, * though */ if (!(match_str_both(data, "\x00\x00\x00\x00", "\x00\x00\x00\x00"))) return false; if (data->payload_len[0] == 108 && data->payload_len[1] == 132) return true; if (data->payload_len[1] == 108 && data->payload_len[0] == 132) return true; if (data->payload_len[0] == 52 && data->payload_len[1] == 196) return true; if (data->payload_len[1] == 52 && data->payload_len[0] == 196) return true; return false; } static lpi_module_t lpi_ventrilo = { LPI_PROTO_UDP_VENTRILO, LPI_CATEGORY_VOIP, "Ventrilo_UDP", 5, match_ventrilo }; void register_ventrilo(LPIModuleMap *mod_map) { register_protocol(&lpi_ventrilo, mod_map); } ================================================ FILE: lib/udp/lpi_viber.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Thanks to Remy Mudingay for providing traces to identify this protocol */ static inline bool match_viber_request(uint32_t payload, uint32_t plen) { if (plen != 12 && plen != 16) return false; if (MATCH(payload, ANY, ANY, 0x03, 0x00)) return true; return false; } static inline bool match_viber_response(uint32_t payload, uint32_t plen) { if (plen == 0) return true; if (plen != 12) return false; if (MATCH(payload, ANY, ANY, 0x04, 0x00)) return true; return false; } static inline bool match_viber_aws0c(uint32_t payload, uint32_t plen) { if (MATCH(payload, ANY, ANY, 0x0c, 0x00)) return true; return false; } static inline bool match_viber_aws01(uint32_t payload, uint32_t plen) { if (MATCH(payload, ANY, ANY, 0x01, 0x00)) return true; return false; } static inline bool same_viber_id(uint32_t pl_a, uint32_t pl_b) { if ((pl_a & 0xffff) == (pl_b & 0xffff)) return true; return false; } static inline bool match_viber_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* These rules target the little 12 byte exchanges that go on */ if (match_viber_request(data->payload[0], data->payload_len[0])) { if (match_viber_response(data->payload[1], data->payload_len[1])) return true; if (match_viber_request(data->payload[1], data->payload_len[1])) return true; } if (match_viber_request(data->payload[1], data->payload_len[1])) { if (match_viber_response(data->payload[0], data->payload_len[0])) return true; if (match_viber_request(data->payload[0], data->payload_len[0])) return true; } /* This targets the viber flow that goes to the AWS server */ if (match_viber_aws0c(data->payload[0], data->payload_len[0])) { if (match_viber_aws01(data->payload[1], data->payload_len[1])) { if (same_viber_id(data->payload[0], data->payload[1])) return true; } } if (match_viber_aws0c(data->payload[1], data->payload_len[1])) { if (match_viber_aws01(data->payload[0], data->payload_len[0])) { if (same_viber_id(data->payload[0], data->payload[1])) return true; } } return false; } static lpi_module_t lpi_viber_udp = { LPI_PROTO_UDP_VIBER, LPI_CATEGORY_VOIP, "Viber_UDP", 18, match_viber_udp }; void register_viber_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_viber_udp, mod_map); } ================================================ FILE: lib/udp/lpi_vivox.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_vivox_request(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x80, 0x7f, 0x00, 0x00) && len == 112) return true; return false; } static inline bool match_vivox_reply(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x80, 0x7f, 0x00, 0x00) && len == 99) return true; return false; } static inline bool match_vivox_stun(uint32_t payload, uint32_t len) { /* Vivox mixes a whole bunch of RTP(?) and STUN together * when it starts up, so sometimes the STUN replies arrive * first. */ if (MATCH(payload, 0x01, 0x01, 0x00, 0x70) && len == 132) return true; return false; } static inline bool match_vivox(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_vivox_request(data->payload[0], data->payload_len[0])) { if (match_vivox_stun(data->payload[1], data->payload_len[1])) return true; if (match_vivox_reply(data->payload[1], data->payload_len[1])) return true; } if (match_vivox_request(data->payload[1], data->payload_len[1])) { if (match_vivox_stun(data->payload[0], data->payload_len[0])) return true; if (match_vivox_reply(data->payload[0], data->payload_len[0])) return true; } /* Seen this to Vivox servers, so I'm going to make the logical * assumption */ if (!match_str_both(data, "\x80\x6f\x00\x00", "\x80\x6f\x00\x01")) return false; if (data->payload_len[0] == 108 || data->payload_len[1] == 108) return true; return false; } static lpi_module_t lpi_vivox = { LPI_PROTO_UDP_VIVOX, LPI_CATEGORY_VOIP, "Vivox", 5, match_vivox }; void register_vivox(LPIModuleMap *mod_map) { register_protocol(&lpi_vivox, mod_map); } ================================================ FILE: lib/udp/lpi_vpnmaster.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* VPN Proxy Master-Free security -- free android VPN via China */ static inline bool match_ce7(uint32_t payload, uint32_t len) { if (len == 30 && MATCH(payload, 'C', 'E', '7', 'E')) return true; if (len == 29 && MATCH(payload, 'C', 'E', '7', 0x05)) return true; return false; } static inline bool match_7b(uint32_t payload, uint32_t len) { if (len == 14 && MATCH(payload, 0x7b, ANY, ANY, ANY)) return true; return false; } static inline bool match_vpnmaster(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_ce7(data->payload[0], data->payload_len[0])) { if (match_7b(data->payload[1], data->payload_len[1])) return true; } if (match_ce7(data->payload[0], data->payload_len[0])) { if (match_7b(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_vpnmaster = { LPI_PROTO_UDP_VPNMASTER, LPI_CATEGORY_TUNNELLING, "VPNMaster", 5, match_vpnmaster }; void register_vpnmaster(LPIModuleMap *mod_map) { register_protocol(&lpi_vpnmaster, mod_map); } ================================================ FILE: lib/udp/lpi_vpnrobot_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_umxw(uint32_t payload) { if (MATCH(payload, 'U', 'M', 'X', 'W')) return true; return false; } static inline bool match_robot_fail(uint32_t payload, uint32_t len) { if (len == 14) { if (MATCH(payload, 0x6d, ANY, ANY, ANY)) return true; } return false; } static inline bool match_vpnrobot_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_umxw(data->payload[0])) { if (match_umxw(data->payload[1])) return true; if (match_robot_fail(data->payload[1], data->payload_len[1])) return true; } if (match_umxw(data->payload[1])) { if (match_robot_fail(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_vpnrobot_udp = { LPI_PROTO_UDP_VPNROBOT, LPI_CATEGORY_TUNNELLING, "VPNRobot", 15, match_vpnrobot_udp }; void register_vpnrobot_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_vpnrobot_udp, mod_map); } ================================================ FILE: lib/udp/lpi_vxworks_exploit.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* VxWorks exposes a system-level debugger over UDP port 17185 which can be * exploited remotely. Most traffic I've seen trying to access this port is * actually critical.io poking around looking for vulnerable machines in the * interests of finding ISPs that are putting their customers at risk. * * So if you see this traffic, it is not necessarily bad (as long as the * recipient is not responding to the probe packet!). */ static inline bool match_vxworks_exploit(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 17185 && data->client_port != 17185) return false; /* Payload sent by critical.io */ if (MATCH(data->payload[0], 0x1a, 0x09, 0xfa, 0xba)) { if (data->payload_len[0] == 64) return true; } if (MATCH(data->payload[1], 0x1a, 0x09, 0xfa, 0xba)) { if (data->payload_len[1] == 64) return true; } return false; } static lpi_module_t lpi_vxworks_exploit = { LPI_PROTO_UDP_VXWORKS_EXPLOIT, LPI_CATEGORY_MALWARE, "VxWorks_Exploit", 14, match_vxworks_exploit }; void register_vxworks_exploit(LPIModuleMap *mod_map) { register_protocol(&lpi_vxworks_exploit, mod_map); } ================================================ FILE: lib/udp/lpi_warthunder.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* MMO game from Gaijin Entertainment. Uses UDP ports 20010+ */ static inline bool match_warthunder_req(uint32_t payload, uint32_t len) { if (len == 52 && MATCHSTR(payload, "\xcf\xff\x00\x0a")) return true; if (len == 52 && MATCHSTR(payload, "\xcf\xff\x00\x0b")) return true; if (len == 52 && MATCHSTR(payload, "\xcf\xff\x00\x05")) return true; if (len == 52 && MATCHSTR(payload, "\xcf\xff\x00\x04")) return true; if (len == 52 && MATCHSTR(payload, "\xcf\xff\x00\x14")) return true; if (len == 52 && MATCHSTR(payload, "\xcf\xff\x00\x03")) return true; if (len == 53 && MATCHSTR(payload, "\xcf\xff\x00\x04")) return true; if (len == 53 && MATCHSTR(payload, "\xcf\xff\x00\x05")) return true; return false; } static inline bool match_warthunder_resp(uint32_t payload, uint32_t len) { if (len == 48 && MATCH(payload, 0xc0, 0x00, ANY, ANY)) return true; if (len == 49 && MATCH(payload, 0xc0, 0x00, ANY, ANY)) return true; if (len == 52 && MATCH(payload, 0xc0, 0x00, ANY, ANY)) return true; return false; } static inline bool match_warthunder(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_warthunder_req(data->payload[1], data->payload_len[1])){ if (match_warthunder_resp(data->payload[0], data->payload_len[0])) return true; } if (match_warthunder_req(data->payload[0], data->payload_len[0])){ if (match_warthunder_resp(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_warthunder = { LPI_PROTO_UDP_WARTHUNDER, LPI_CATEGORY_GAMING, "WarThunder", 9, match_warthunder }; void register_warthunder(LPIModuleMap *mod_map) { register_protocol(&lpi_warthunder, mod_map); } ================================================ FILE: lib/udp/lpi_webex.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_webex_req(uint32_t payload, uint32_t len) { if (len == 8 && MATCH(payload, 0x01, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_webex_resp(uint32_t payload, uint32_t len) { if (len == 8 && MATCH(payload, 0x02, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_webex(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Port 9000 */ if (data->server_port != 9000 && data->client_port != 9000) return false; if (match_webex_req(data->payload[0], data->payload_len[0])) { if (match_webex_resp(data->payload[1], data->payload_len[1])) return true; } if (match_webex_req(data->payload[1], data->payload_len[1])) { if (match_webex_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_webex = { LPI_PROTO_UDP_WEBEX, LPI_CATEGORY_VOIP, "Webex", 100, match_webex }; void register_webex(LPIModuleMap *mod_map) { register_protocol(&lpi_webex, mod_map); } ================================================ FILE: lib/udp/lpi_wechat_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Thanks to http://www.cse.cuhk.edu.hk/~pclee/www/pubs/iwqos15chatdissect.pdf * for helping confirm this rule */ static inline bool match_wechat_uplink_hb(uint32_t payload, uint32_t len) { /* Byte 3 appears to be a length indicator */ if (MATCH(payload, 0xd1, 0x0a, 0x2e, 0x0a)) return true; if (MATCH(payload, 0xd1, 0x0a, 0x2d, 0x0a)) return true; if (MATCH(payload, 0xd1, 0x0a, 0x2c, 0x0a)) return true; if (MATCH(payload, 0xd1, 0x0a, 0x1e, 0x0a)) return true; if (MATCH(payload, 0xd1, 0x0a, 0x1d, 0x0a)) return true; return false; } static inline bool match_wechat_downlink_hb(uint32_t payload, uint32_t len) { /* Byte 3 appears to be a length indicator */ if (MATCHSTR(payload, "\xd1\x0a\x2b\x0a")) return true; if (MATCHSTR(payload, "\xd1\x0a\x2a\x0a")) return true; if (MATCHSTR(payload, "\xd1\x0a\x2d\x0a")) return true; if (MATCHSTR(payload, "\xd1\x0a\x29\x0a")) return true; return false; } static inline bool match_wechat_voip_a175(uint32_t payload, uint32_t len) { if (MATCH(payload, 0xa1, 0x08, ANY, ANY) && len == 75) return true; return false; } static inline bool match_wechat_voip_a192(uint32_t payload, uint32_t len) { if (MATCH(payload, 0xa1, 0x08, ANY, ANY) && len == 92) return true; return false; } static inline bool match_wechat_voip_a396(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len == 96 && MATCH(payload, 0xa3, ANY, ANY, ANY)) return true; if (len == 95 && MATCH(payload, 0xa3, ANY, ANY, ANY)) return true; return false; } static inline bool match_wechat_voip_d6200(uint32_t payload, uint32_t len) { if (len == 200 && MATCH(payload, 0xd6, ANY, ANY, ANY)) return true; return false; } static inline bool match_wechat_voip_d591(uint32_t payload, uint32_t len) { if (len < 89 || len > 91) return false; if (MATCH(payload, 0xd5, ANY, ANY, ANY)) return true; return false; } static inline bool match_wechat_voip_d5104(uint32_t payload, uint32_t len) { if (len < 103 || len > 104) return false; if (MATCH(payload, 0xd5, ANY, ANY, ANY)) return true; return false; } static inline bool match_wechat_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_wechat_uplink_hb(data->payload[0], data->payload_len[0])) { if (match_wechat_downlink_hb(data->payload[1], data->payload_len[1])) return true; } if (match_wechat_uplink_hb(data->payload[1], data->payload_len[1])) { if (match_wechat_downlink_hb(data->payload[0], data->payload_len[0])) return true; } /* Lots of different patterns seen when using WeChat to make a voice * or video call. */ if (match_wechat_voip_a396(data->payload[0], data->payload_len[0])) { if (match_wechat_voip_a396(data->payload[1], data->payload_len[1])) return true; } if (match_wechat_voip_d6200(data->payload[0], data->payload_len[0])) { if (match_wechat_voip_d6200(data->payload[1], data->payload_len[1])) return true; } if (match_wechat_voip_d591(data->payload[0], data->payload_len[0])) { if (match_wechat_voip_d5104(data->payload[1], data->payload_len[1])) return true; } if (match_wechat_voip_d591(data->payload[1], data->payload_len[1])) { if (match_wechat_voip_d5104(data->payload[0], data->payload_len[0])) return true; } if (match_wechat_voip_a192(data->payload[0], data->payload_len[0])) { if (match_wechat_voip_a175(data->payload[1], data->payload_len[1])) return true; } if (match_wechat_voip_a192(data->payload[1], data->payload_len[1])) { if (match_wechat_voip_a175(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_wechat_udp = { LPI_PROTO_UDP_WECHAT, LPI_CATEGORY_CHAT, "WeChat_UDP", 20, match_wechat_udp }; void register_wechat_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_wechat_udp, mod_map); } ================================================ FILE: lib/udp/lpi_winmessage.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* * This covers Windows messenger spam over UDP * * Ref: http://www.mynetwatchman.com/kb/security/articles/popupspam/netsend.htm */ static inline bool match_winmessage(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "\x04\x00\x28\x00", "\x04\x02\x08\x00")) return true; if (match_str_either(data, "\x04\x00\x28\x00")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } return false; } static lpi_module_t lpi_winmessage = { LPI_PROTO_UDP_WIN_MESSAGE, LPI_CATEGORY_MALWARE, "WindowsMessenger", 10, match_winmessage }; void register_winmessage(LPIModuleMap *mod_map) { register_protocol(&lpi_winmessage, mod_map); } ================================================ FILE: lib/udp/lpi_wireguard.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_wg_first(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x01, 0x00, 0x00, 0x00) && len == 148) { return true; } return false; } static inline bool match_wg_second(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x02, 0x00, 0x00, 0x00) && len == 92) { return true; } return false; } static inline bool match_wg_midsession(uint32_t payload, uint32_t len) { /* Not a very strong rule, but should only matter if the initial * packets go missing. */ if (MATCH(payload, 0x04, 0x00, 0x00, 0x00)) { if (len >= 92 && len <= 512) { return true; } } return false; } static inline bool match_wireguard(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_wg_first(data->payload[0], data->payload_len[0])) { if (match_wg_second(data->payload[1], data->payload_len[1])) { return true; } if (match_wg_midsession(data->payload[1], data->payload_len[1])) { return true; } } if (match_wg_first(data->payload[1], data->payload_len[1])) { if (match_wg_second(data->payload[0], data->payload_len[0])) { return true; } if (match_wg_midsession(data->payload[0], data->payload_len[0])) { return true; } } if (match_wg_second(data->payload[0], data->payload_len[0])) { if (match_wg_midsession(data->payload[1], data->payload_len[1])) { return true; } } if (match_wg_second(data->payload[1], data->payload_len[1])) { if (match_wg_midsession(data->payload[0], data->payload_len[0])) { return true; } } if (match_wg_midsession(data->payload[0], data->payload_len[0])) { if (match_wg_midsession(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_wireguard = { LPI_PROTO_UDP_WIREGUARD, LPI_CATEGORY_TUNNELLING, "WireGuard", 201, match_wireguard }; void register_wireguard(LPIModuleMap *mod_map) { register_protocol(&lpi_wireguard, mod_map); } ================================================ FILE: lib/udp/lpi_wolfet.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_wolf_payload(uint32_t payload, uint32_t len) { if (len == 0) return true; if (!MATCHSTR(payload, "\xff\xff\xff\xff")) return false; return true; } static inline bool match_wolf_et(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Limit to port 27960 for now */ if (data->server_port != 27960 && data->client_port != 27960) return false; if (!match_wolf_payload(data->payload[0], data->payload_len[0])) return false; if (!match_wolf_payload(data->payload[1], data->payload_len[1])) return false; /* getinfo packet is always 15 bytes, the other is always 250-350 */ if (data->payload_len[0] == 15) { if (data->payload_len[1] == 0 || (data->payload_len[1] >= 250 && data->payload_len[1] < 350)) return true; } if (data->payload_len[1] == 15) { if (data->payload_len[0] == 0 || (data->payload_len[0] >= 250 && data->payload_len[0] < 350)) return true; } /* getservers packets are 17 bytes, response may vary a lot (?) */ if (data->payload_len[0] == 17) return true; if (data->payload_len[1] == 17) return true; return false; } static lpi_module_t lpi_wolfet = { LPI_PROTO_UDP_WOLF_ET, LPI_CATEGORY_GAMING, "WolfensteinEnemyTerritory", 50, /* Must be lower priority than Call of Duty */ match_wolf_et }; void register_wolfet(LPIModuleMap *mod_map) { register_protocol(&lpi_wolfet, mod_map); } ================================================ FILE: lib/udp/lpi_worm_22105.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_worm_22105(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_either(data, " VRV")) return true; return false; } static lpi_module_t lpi_worm_22105 = { LPI_PROTO_UDP_WORM_22105, LPI_CATEGORY_MALWARE, "Worm_22105", 10, match_worm_22105 }; void register_worm_22105(LPIModuleMap *mod_map) { register_protocol(&lpi_worm_22105, mod_map); } ================================================ FILE: lib/udp/lpi_xfire_p2p.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_xfire_p2p(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_str_both(data, "SC01", "CK01")) return true; if (match_str_either(data, "MC01")) return true; return false; } static lpi_module_t lpi_xfire_p2p = { LPI_PROTO_UDP_XFIRE_P2P, LPI_CATEGORY_P2P, "Xfire_P2P", 3, match_xfire_p2p }; void register_xfire_p2p(LPIModuleMap *mod_map) { register_protocol(&lpi_xfire_p2p, mod_map); } ================================================ FILE: lib/udp/lpi_xlsp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_xlsp_payload(uint32_t payload, uint32_t len, uint32_t other_len, lpi_data_t *data) { /* This is almost all based on observing traffic on port 3074. Not * very scientific, but seems more or less right */ /* TODO: come up with a cleaner matching module */ /* We've only ever seen a few of the packet sizes in one-way flows, * so let's not match any of the others if there is no response */ if (MATCH(payload, 0x00, 0x00, 0x00, 0x00)) { if (len == 139) return true; if (len == 122) return true; if (len == 156) return true; if (len == 82) return true; if (len == 50) return true; if (len == 83) return true; if (len == 43) return true; if (len == 75) return true; if (len == 120 && other_len != 0) return true; if (len == 91 && other_len != 0) return true; if (len == 0 && other_len != 0) return true; if ((len == 90 || len == 172) && other_len == 138) return true; if (len == 138 && (other_len == 90 || other_len == 172)) return true; if (len == 65 && other_len == 65) return true; if ((len == 148 || len == 149) && (other_len == 115 || other_len == 116)) return true; if ((len == 115 || len == 116) && (other_len == 148 || other_len == 149)) return true; } if (len == 24) { /* Employ port number restriction because these rules are weak */ if (data->server_port != 3074 && data->client_port != 3074) return false; if (MATCH(payload, 0x0d, ANY, ANY, ANY)) return true; if (MATCH(payload, 0x80, ANY, ANY, ANY)) return true; } if (len == 16) { if (MATCH(payload, 0x01, 0x02, 0x00, 0x00)) return true; } if (len == 32) { /* Employ port number restriction because these rules are weak */ if (data->server_port != 3074 && data->client_port != 3074) return false; if (MATCH(payload, 0x06, 0x02, ANY, ANY)) return true; if (MATCH(payload, 0xcd, ANY, ANY, ANY)) return true; } if (len == 17) { /* Employ port number restriction because these rules are weak */ if (data->server_port != 3074 && data->client_port != 3074) return false; if (MATCH(payload, 0x28, ANY, ANY, ANY)) return true; } if (len == 287 || len == 1336 || len == 1011) { /* Employ port number restriction because these rules are weak */ if (data->server_port != 3074 && data->client_port != 3074) return false; if (other_len != 0) return false; if (MATCH(payload, 0x00, 0x00, 0x00, 0x00)) return true; } if (len == 26) { if (MATCH(payload, 0x29, ANY, 0x00, 0x00)) return true; } if (len == 29) { if (MATCH(payload, 0x0a, 0x02, 0x00, ANY)) return true; if (MATCH(payload, 0x0b, 0x02, 0x00, ANY)) return true; if (MATCH(payload, 0x0c, 0x02, 0x00, ANY)) return true; if (MATCH(payload, 0x0d, 0x02, 0x00, ANY)) return true; if (MATCH(payload, 0x0e, 0x02, 0x00, ANY)) return true; } return false; } static inline bool match_xlsp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Had a few false matches against DNS traffic in the past, so * rule out port 53 traffic */ if (data->server_port == 53 || data->client_port == 53) return false; /* Unlike other combos, 1336 and 287 (or rarely 286) only go with * each other * * 1011 (or rarely 1010) is also a possible response */ if (match_str_both(data, "\x00\x00\x00\x00", "\x00\x00\x00\x00")) { if (data->payload_len[0] == 1336) { if (data->payload_len[1] == 287) return true; if (data->payload_len[1] == 1011) return true; if (data->payload_len[1] == 286) return true; if (data->payload_len[1] == 1010) return true; if (data->payload_len[1] == 1003) return true; if (data->payload_len[1] == 1026) return true; if (data->payload_len[1] == 1027) return true; if (data->payload_len[1] == 1331) return true; } if (data->payload_len[1] == 1336) { if (data->payload_len[0] == 287) return true; if (data->payload_len[0] == 1011) return true; if (data->payload_len[0] == 286) return true; if (data->payload_len[0] == 1010) return true; if (data->payload_len[0] == 1003) return true; if (data->payload_len[0] == 1026) return true; if (data->payload_len[0] == 1027) return true; if (data->payload_len[0] == 1331) return true; } /* This is something to do with PunkBuster? */ if (data->payload_len[0] == 4) { if (data->payload_len[1] == 4) return true; } if (data->payload_len[1] == 4) { if (data->payload_len[0] == 4) return true; } } /* Enforce port 3074 being involved, to reduce false positive rate for * one-way transactions */ if (match_str_either(data, "\xff\xff\xff\xff")) { if (data->server_port != 3074 && data->client_port != 3074) return false; if (data->payload_len[0] == 14 && data->payload_len[1] == 0) return true; if (data->payload_len[1] == 14 && data->payload_len[0] == 0) return true; } /* We could also enforce the port number here too, but we still see a * lot of one-way traffic that matches these rules on other ports. * I'm pretty confident it is XLSP, but this should be watched * closely to make sure it isn't overmatching */ if (!match_xlsp_payload(data->payload[0], data->payload_len[0], data->payload_len[1], data)) return false; if (!match_xlsp_payload(data->payload[1], data->payload_len[1], data->payload_len[0], data)) return false; return true; } static lpi_module_t lpi_xlsp = { LPI_PROTO_UDP_XLSP, LPI_CATEGORY_GAMING, "XboxLive_UDP", 180, match_xlsp }; void register_xlsp(LPIModuleMap *mod_map) { register_protocol(&lpi_xlsp, mod_map); } ================================================ FILE: lib/udp/lpi_xunlei.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool xunlei_32(uint32_t payload, uint32_t len) { if (len == 0) return true; if (!MATCH(payload, 0x32, 0x00, 0x00, 0x00)) return false; if (len == 29) return true; if (len == 31) return true; return false; } static inline bool match_shuijing_3b_other(uint32_t payload, uint32_t len) { if (!MATCH(payload, 0x3b, 0x00, 0x00, 0x00)) return false; if (len == 31 || len == 29 || len == 42) return true; return false; } static inline bool match_shuijing_32(uint32_t payload, uint32_t len) { if (len == 31 && MATCH(payload, 0x32, 0x00, 0x00, 0x00)) return true; if (len == 29 && MATCH(payload, 0x32, 0x00, 0x00, 0x00)) return true; if (len == 42 && MATCH(payload, 0x32, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_shuijing_3b(uint32_t payload, uint32_t len) { if (len == 33 && MATCH(payload, 0x3b, 0x00, 0x00, 0x00)) return true; if (len == 31 && MATCH(payload, 0x3b, 0x00, 0x00, 0x00)) return true; if (len == 29 && MATCH(payload, 0x3b, 0x00, 0x00, 0x00)) return true; if (len == 13 && MATCH(payload, 0x3b, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_xunlei_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* Shuijing = "Thunder Crystal", a P2P CDN approach used by Xunlei. * Uses UDP port 4693 normally */ if (match_shuijing_3b(data->payload[0], data->payload_len[0])) { if (match_shuijing_3b_other(data->payload[1], data->payload_len[1])) return true; if (match_shuijing_32(data->payload[1], data->payload_len[1])) return true; } if (match_shuijing_3b(data->payload[1], data->payload_len[1])) { if (match_shuijing_3b_other(data->payload[0], data->payload_len[0])) return true; if (match_shuijing_32(data->payload[0], data->payload_len[0])) return true; } /* Traffic seen while operating the Thunder client, not sure on exact * purpose but can lead to large flows. Rule is not very strong, since * the payload seems random. */ if (data->server_port == 12345 || data->client_port == 12345) { if (data->payload[0] != 0 && data->payload[1] != 0) { if (data->payload_len[0] >= 39) { if (data->payload_len[0] <= 43) { if (data->payload_len[1] >= 39) { if (data->payload_len[1] <= 43) return true; } } } } } if (match_str_both(data, "\x32\x00\x00\x00", "\x32\x00\x00\x00")) return true; if (match_str_both(data, "\x36\x00\x00\x00", "\x36\x00\x00\x00")) return true; if (match_str_both(data, "\x35\x00\x00\x00", "\x35\x00\x00\x00")) return true; if (match_str_both(data, "\x35\x00\x00\x00", "\x28\x00\x00\x00")) return true; if (match_str_both(data, "\x35\x00\x00\x00", "\x29\x00\x00\x00")) return true; if (match_str_both(data, "\x34\x00\x00\x00", "\x34\x00\x00\x00")) return true; if (match_str_both(data, "\x34\x00\x00\x00", "\x29\x00\x00\x00")) return true; if (match_str_both(data, "\x33\x00\x00\x00", "\x33\x00\x00\x00")) return true; if (xunlei_32(data->payload[0], data->payload_len[0])) { if (xunlei_32(data->payload[1], data->payload_len[1])) return true; } /* Require port 3076 for now, as all these rules are based on * traffic seen on port 3076 */ if (data->server_port != 3076 && data->client_port != 3076) return false; if (match_str_either(data, "\x36\x00\x00\x00")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } if (match_str_either(data, "\x35\x00\x00\x00")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } if (match_str_either(data, "\x34\x00\x00\x00")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } if (match_str_either(data, "\x33\x00\x00\x00")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } if (match_str_either(data, "\x29\x00\x00\x00")) { if (data->payload_len[0] == 0) return true; if (data->payload_len[1] == 0) return true; } return false; } static lpi_module_t lpi_xunlei_udp = { LPI_PROTO_UDP_XUNLEI, LPI_CATEGORY_P2P, "Xunlei_UDP", 203, match_xunlei_udp }; void register_xunlei_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_xunlei_udp, mod_map); } ================================================ FILE: lib/udp/lpi_xunlei_jsq.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* JSQ: a game accelerator service offered by Xunlei. * * The actual accelerator service itself is VIP-only (i.e. pay for it), * but the log in, server querying etc, will still work for free so that's * mostly what we're matching here. * */ static inline bool match_jsq_req(uint32_t payload, uint32_t len) { if (len != 150 && (len < 77 || len > 80)) return false; if (MATCH(payload, 0x64, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_jsq_resp(uint32_t payload, uint32_t len) { if (len == 0) return true; if (len != 40) return false; if (MATCH(payload, 0x64, 0x00, 0x00, 0x00)) return true; return false; } static inline bool match_xunlei_jsq(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 8080 && data->client_port != 8080) { return false; } if (match_jsq_req(data->payload[0], data->payload_len[0])) { if (match_jsq_resp(data->payload[1], data->payload_len[1])) return true; } if (match_jsq_req(data->payload[1], data->payload_len[1])) { if (match_jsq_resp(data->payload[0], data->payload_len[0])) return true; } return false; } static lpi_module_t lpi_xunlei_jsq = { LPI_PROTO_UDP_XUNLEI_JSQ, LPI_CATEGORY_GAMING, "XunleiJSQ", 25, match_xunlei_jsq }; void register_xunlei_jsq(LPIModuleMap *mod_map) { register_protocol(&lpi_xunlei_jsq, mod_map); } ================================================ FILE: lib/udp/lpi_xunyou.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_xunyou(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (data->server_port != 8000 && data->client_port != 8000) return false; if (data->payload[0] != 0) return false; if (data->payload[1] != 0) return false; if (data->payload_len[0] != 2) return false; if (data->payload_len[1] != 2) return false; return true; } static lpi_module_t lpi_xunyou = { LPI_PROTO_UDP_XUNYOU, LPI_CATEGORY_GAMING, "Xunyou", 210, match_xunyou }; void register_xunyou(LPIModuleMap *mod_map) { register_protocol(&lpi_xunyou, mod_map); } ================================================ FILE: lib/udp/lpi_youdao_dict.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_youdao_dict(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* All signs point to this being the protocol used by Youdao * Dictionary software * * Can force a check for port 2000 if need be */ if (match_str_both(data, "type", "\x1f\x8b\x08\x00")) return true; return false; } static lpi_module_t lpi_youdao_dict = { LPI_PROTO_UDP_YOUDAO_DICT, LPI_CATEGORY_TRANSLATION, "YoudaoDict", 10, match_youdao_dict }; void register_youdao_dict(LPIModuleMap *mod_map) { register_protocol(&lpi_youdao_dict, mod_map); } ================================================ FILE: lib/udp/lpi_youku.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_youku_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* This took a lot of detective work and liberal use of Google * translate to figure out what this protocol this pattern matched */ if (match_youku_payload(data->payload[0], data->payload_len[0])) { if (match_youku_payload(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_youku = { LPI_PROTO_UDP_YOUKU, LPI_CATEGORY_STREAMING, "Youku_UDP", 4, match_youku_udp }; void register_youku_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_youku, mod_map); } ================================================ FILE: lib/udp/lpi_yuanfudao.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* Unable to confirm because yuanfudao requires a Chinese mobile number */ static inline bool match_yuan_7b(uint32_t payload, uint32_t len) { if (len == 33 && MATCH(payload, 0x80, 0x7b, 0x00, 0x00)) { return true; } return false; } static inline bool match_yuan_7c(uint32_t payload, uint32_t len) { if (len == 32 || len == 48 || len == 60) { if (MATCH(payload, 0x80, 0x7c, 0x00, 0x00)) { return true; } } return false; } static inline bool match_yuanfudao(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_yuan_7b(data->payload[0], data->payload_len[0])) { if (match_yuan_7c(data->payload[1], data->payload_len[1])) { return true; } } if (match_yuan_7b(data->payload[1], data->payload_len[1])) { if (match_yuan_7c(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_yuanfudao = { LPI_PROTO_UDP_YUANFUDAO, LPI_CATEGORY_STREAMING, "Yuanfudao", 79, match_yuanfudao }; void register_yuanfudao(LPIModuleMap *mod_map) { register_protocol(&lpi_yuanfudao, mod_map); } ================================================ FILE: lib/udp/lpi_yy_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* YY Live Streaming from China */ /* Unfortunately YY uses a 4 byte length field (albeit in little endian * byte order) so there's a good chance this rule will get a few FPs :/ */ static inline bool match_yy_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_yy_payload(data->payload[0], data->payload_len[0])) { if (match_yy_payload(data->payload[1], data->payload_len[1])) return true; } return false; } static lpi_module_t lpi_yy_udp = { LPI_PROTO_UDP_YY, LPI_CATEGORY_STREAMING, "YY_UDP", 200, match_yy_udp }; void register_yy_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_yy_udp, mod_map); } ================================================ FILE: lib/udp/lpi_zalo_call.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_zalo_pat(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x01, 0x01, 0x00, 0x00)) { if (len == 26 || len == 27) return true; if (len == 34) return true; if (len == 42) return true; } return false; } static inline bool match_zalo_185(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x01, 0x01, 0x00, 0x00)) { if (len >= 180 && len <= 185) { return true; } } return false; } static inline bool match_zalo_56(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x02, 0x01, 0x00, 0x00)) { if (len >= 52 && len <= 56) { return true; } } return false; } static inline bool match_zalo_call(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_zalo_pat(data->payload[0], data->payload_len[0])) { if (match_zalo_pat(data->payload[1], data->payload_len[1])) { if (data->payload_len[0] == data->payload_len[1]) return true; } } if (match_zalo_185(data->payload[0], data->payload_len[0])) { if (match_zalo_56(data->payload[1], data->payload_len[1])) { return true; } } if (match_zalo_185(data->payload[1], data->payload_len[1])) { if (match_zalo_56(data->payload[0], data->payload_len[0])) { return true; } } return false; } static lpi_module_t lpi_zalo_call = { LPI_PROTO_UDP_ZALO_CALL, LPI_CATEGORY_VOIP, "ZaloVideoCall", 199, match_zalo_call }; void register_zalo_call(LPIModuleMap *mod_map) { register_protocol(&lpi_zalo_call, mod_map); } ================================================ FILE: lib/udp/lpi_zeroaccess_udp.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" /* This protocol is used by the ZeroAccess Trojan for P2P communication * between infected hosts. * * http://www.kindsight.net/sites/default/files/Kindsight_Malware_Analysis-New_CC_protocol_ZeroAccess-final2.pdf */ static inline bool using_zeroaccess_port(lpi_data_t *data) { switch(data->server_port) { case 16464: case 16465: case 16470: case 16471: return true; } switch(data->client_port) { case 16464: case 16465: case 16470: case 16471: return true; } return false; } static inline bool match_zeroaccess_udp(lpi_data_t *data, lpi_module_t *mod UNUSED) { /* ZeroAccess uses specific ports for talking to peers */ if (!using_zeroaccess_port(data)) { return false; } /* The infected host always sends a 16 byte UDP packet to the * peer - the response packet size is based solely on what we've * observed in the wild. * * Since both payloads begin with a 32 byte checksum, we can't * do much based on payload patterns */ /* Pretty unlikely that the CRC will be exactly 0, but 0 is a * common payload for other UDP protocols */ if (data->payload[0] == 0 && data->payload_len[0] != 0) return false; if (data->payload[1] == 0 && data->payload_len[1] != 0) return false; if (data->payload_len[0] == 16) { if (data->payload_len[1] == 848) return true; if (data->payload_len[1] == 988) return true; if (data->payload_len[1] == 568) return true; /* If no response, lets at least force it to be on the * default port before reporting a match */ if (data->payload_len[1] == 0) { if (data->server_port == 16464) return true; if (data->client_port == 16464) return true; } } if (data->payload_len[1] == 16) { if (data->payload_len[0] == 848) return true; if (data->payload_len[0] == 988) return true; if (data->payload_len[0] == 568) return true; /* If no response, lets at least force it to be on the * default port before reporting a match */ if (data->payload_len[0] == 0) { if (data->server_port == 16464) return true; if (data->client_port == 16464) return true; } } return false; } static lpi_module_t lpi_zeroaccess_udp = { LPI_PROTO_UDP_ZEROACCESS, LPI_CATEGORY_MALWARE, "ZeroAccess_UDP", 40, match_zeroaccess_udp }; void register_zeroaccess_udp(LPIModuleMap *mod_map) { register_protocol(&lpi_zeroaccess_udp, mod_map); } ================================================ FILE: lib/udp/lpi_zoom.cc ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #include #include "libprotoident.h" #include "proto_manager.h" #include "proto_common.h" static inline bool match_zoom_01(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x01, 0x00, 0x02, ANY)) { if (len == 107 || len == 109 || len == 169) return true; } if (MATCH(payload, 0x01, 0x00, 0x03, ANY)) { if (len == 187 || len == 185 || len == 123 || len == 125) { return true; } } if (MATCH(payload, 0x01, 0x00, 0x6c, 0x00) && len == 111) return true; return false; } static inline bool match_zoom_02(uint32_t payload, uint32_t len) { if (MATCH(payload, 0x02, 0x00, 0x01, ANY) && len == 35) return true; if (MATCH(payload, 0x02, 0x00, 0x03, ANY) && len == 105) return true; if (MATCH(payload, 0x02, 0x00, 0x03, ANY) && len == 43) return true; if (MATCH(payload, 0x02, 0x00, 0x22, 0x00) && len == 37) return true; if (MATCH(payload, 0x02, 0x00, 0x24, 0x00) && len == 39) return true; return false; } static inline bool match_zoom_05(uint32_t payload) { if (MATCH(payload, 0x05, 0x10, 0x01, 0x00)) return true; if (MATCH(payload, 0x05, 0x0f, 0x01, 0x00)) return true; if (MATCH(payload, 0x05, 0x15, 0x01, 0x00)) return true; return false; } static inline bool match_zoom_stream_hello(uint32_t payload, uint32_t len) { /* Seen 72, 85 and 86 so far */ if (len >= 72 && len <= 90) { if (MATCH(payload, 0x1f, 0x01, 0x01, 0x00)) return true; } return false; } static inline bool match_zoom_manager(lpi_data_t *data) { if (data->server_port != 8801 && data->client_port != 8801) { return false; } /* Byte 4 must match in both directions */ if ((data->payload[0] & 0xff000000) != (data->payload[1] & 0xff000000)) return false; if (match_zoom_01(data->payload[0], data->payload_len[0])) { if (match_zoom_02(data->payload[1], data->payload_len[1])) return true; } if (match_zoom_01(data->payload[1], data->payload_len[1])) { if (match_zoom_02(data->payload[0], data->payload_len[0])) return true; } if (match_zoom_05(data->payload[0]) && match_zoom_05(data->payload[1])) return true; return false; } static inline bool match_zoom_stream(lpi_data_t *data) { if (match_zoom_stream_hello(data->payload[0], data->payload_len[0])) { if (match_zoom_stream_hello(data->payload[1], data->payload_len[1])) return true; } return false; } static inline bool match_zoom(lpi_data_t *data, lpi_module_t *mod UNUSED) { if (match_zoom_manager(data)) return true; if (match_zoom_stream(data)) return true; return false; } static lpi_module_t lpi_zoom = { LPI_PROTO_UDP_ZOOM, LPI_CATEGORY_VOIP, "Zoom", 5, match_zoom }; void register_zoom(LPIModuleMap *mod_map) { register_protocol(&lpi_zoom, mod_map); } ================================================ FILE: lib/udp/udp_protocols.h ================================================ /* * * Copyright (c) 2011-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libprotoident. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * */ #ifndef UDP_PROTOCOLS_H_ #define UDP_PROTOCOLS_H_ #include "proto_manager.h" void register_360cn(LPIModuleMap *mod_map); void register_360p2p(LPIModuleMap *mod_map); void register_aachen_udp(LPIModuleMap *mod_map); void register_acercloud(LPIModuleMap *mod_map); void register_akamai(LPIModuleMap *mod_map); void register_akamai_transfer(LPIModuleMap *mod_map); void register_amanda(LPIModuleMap *mod_map); void register_apple_facetime_init(LPIModuleMap *mod_map); void register_ard(LPIModuleMap *mod_map); void register_ares_udp(LPIModuleMap *mod_map); void register_arksurvival(LPIModuleMap *mod_map); void register_arma_server(LPIModuleMap *mod_map); void register_arma3_server(LPIModuleMap *mod_map); void register_artcp(LPIModuleMap *mod_map); void register_assettocorsa(LPIModuleMap *mod_map); void register_avast_secure_dns(LPIModuleMap *mod_map); void register_backweb(LPIModuleMap *mod_map); void register_bacnet(LPIModuleMap *mod_map); void register_baiduyun_p2p(LPIModuleMap *mod_map); void register_baofeng_udp(LPIModuleMap *mod_map); void register_battlefield(LPIModuleMap *mod_map); void register_bjnp(LPIModuleMap *mod_map); void register_bmdp(LPIModuleMap *mod_map); void register_btsync_udp(LPIModuleMap *mod_map); void register_cacaoweb_udp(LPIModuleMap *mod_map); void register_callofduty(LPIModuleMap *mod_map); void register_canon_mfnp(LPIModuleMap *mod_map); void register_chargen_exploit(LPIModuleMap *mod_map); void register_checkpoint_rdp(LPIModuleMap *mod_map); void register_chivalry(LPIModuleMap *mod_map); void register_ethernetip_udp(LPIModuleMap *mod_map); void register_cip_io(LPIModuleMap *mod_map); void register_cirn(LPIModuleMap *mod_map); void register_cisco_ipsec(LPIModuleMap *mod_map); void register_cisco_sslvpn(LPIModuleMap *mod_map); void register_classin_udp(LPIModuleMap *mod_map); void register_cloudflare_warp(LPIModuleMap *mod_map); void register_codmobile(LPIModuleMap *mod_map); void register_combatarms(LPIModuleMap *mod_map); void register_combatarms_p2p(LPIModuleMap *mod_map); void register_contract_wars(LPIModuleMap *mod_map); void register_crossfire(LPIModuleMap *mod_map); void register_crossout(LPIModuleMap *mod_map); void register_csgo(LPIModuleMap *mod_map); void register_csoriginal(LPIModuleMap *mod_map); void register_dahua(LPIModuleMap *mod_map); void register_db2(LPIModuleMap *mod_map); void register_dcc_udp(LPIModuleMap *mod_map); void register_demonware(LPIModuleMap *mod_map); void register_destiny_udp(LPIModuleMap *mod_map); void register_dhcp(LPIModuleMap *mod_map); void register_dht_dict(LPIModuleMap *mod_map); void register_dht_other(LPIModuleMap *mod_map); void register_diablo2(LPIModuleMap *mod_map); void register_dianping_udp(LPIModuleMap *mod_map); void register_dianshijia(LPIModuleMap *mod_map); void register_directconnect_udp(LPIModuleMap *mod_map); void register_discord(LPIModuleMap *mod_map); void register_dns_udp(LPIModuleMap *mod_map); void register_dota2(LPIModuleMap *mod_map); void register_doyo(LPIModuleMap *mod_map); void register_driveshare(LPIModuleMap *mod_map); void register_dtls(LPIModuleMap *mod_map); void register_emule_udp(LPIModuleMap *mod_map); void register_emule_weak_udp(LPIModuleMap *mod_map); void register_epson(LPIModuleMap *mod_map); void register_eso(LPIModuleMap *mod_map); void register_esp_encap(LPIModuleMap *mod_map); void register_eye_udp(LPIModuleMap *mod_map); void register_fasp(LPIModuleMap *mod_map); void register_feitwo(LPIModuleMap *mod_map); void register_forticlient_sslvpn(LPIModuleMap *mod_map); void register_fortinet(LPIModuleMap *mod_map); void register_foscam(LPIModuleMap *mod_map); void register_freechal(LPIModuleMap *mod_map); void register_freefire(LPIModuleMap *mod_map); void register_funshion_udp(LPIModuleMap *mod_map); void register_gamespy(LPIModuleMap *mod_map); void register_ganglia(LPIModuleMap *mod_map); void register_gangsofspace(LPIModuleMap *mod_map); void register_garena(LPIModuleMap *mod_map); void register_gearsofwar(LPIModuleMap *mod_map); void register_gnutella_udp(LPIModuleMap *mod_map); void register_gnutella2_udp(LPIModuleMap *mod_map); void register_gnutella_weak(LPIModuleMap *mod_map); void register_gotomeeting(LPIModuleMap *mod_map); void register_gprs_tunnel(LPIModuleMap *mod_map); void register_gsm(LPIModuleMap *mod_map); void register_h1z1(LPIModuleMap *mod_map); void register_halflife(LPIModuleMap *mod_map); void register_haloonline(LPIModuleMap *mod_map); void register_hamachi_udp(LPIModuleMap *mod_map); void register_heliborne(LPIModuleMap *mod_map); void register_heroesevolved(LPIModuleMap *mod_map); void register_heroes_generals(LPIModuleMap *mod_map); void register_hollachat(LPIModuleMap *mod_map); void register_hots(LPIModuleMap *mod_map); void register_icp(LPIModuleMap *mod_map); void register_imesh_udp(LPIModuleMap *mod_map); void register_ipmsg(LPIModuleMap *mod_map); void register_ipv6_udp(LPIModuleMap *mod_map); void register_isakmp(LPIModuleMap *mod_map); void register_jedi_academy(LPIModuleMap *mod_map); void register_jedi_udp(LPIModuleMap *mod_map); void register_kademlia(LPIModuleMap *mod_map); void register_kankan(LPIModuleMap *mod_map); void register_kaspersky_udp(LPIModuleMap *mod_map); void register_kazaa(LPIModuleMap *mod_map); void register_kingofglory_udp(LPIModuleMap *mod_map); void register_kugou(LPIModuleMap *mod_map); void register_l2tp(LPIModuleMap *mod_map); void register_lansync_udp(LPIModuleMap *mod_map); void register_ldap_ad(LPIModuleMap *mod_map); void register_line_udp(LPIModuleMap *mod_map); void register_linkproof(LPIModuleMap *mod_map); void register_loadout(LPIModuleMap *mod_map); void register_lol(LPIModuleMap *mod_map); void register_mdns(LPIModuleMap *mod_map); void register_merakicloud(LPIModuleMap *mod_map); void register_moh(LPIModuleMap *mod_map); void register_moonhunters(LPIModuleMap *mod_map); void register_mp2p_udp(LPIModuleMap *mod_map); void register_msn_cache(LPIModuleMap *mod_map); void register_msn_video(LPIModuleMap *mod_map); void register_msoffice_mac(LPIModuleMap *mod_map); void register_mta(LPIModuleMap *mod_map); void register_mystery_05(LPIModuleMap *mod_map); void register_mystery_0660(LPIModuleMap *mod_map); void register_mystery_0d(LPIModuleMap *mod_map); void register_mystery_45(LPIModuleMap *mod_map); void register_mystery_61_72(LPIModuleMap *mod_map); void register_mystery_8000_udp(LPIModuleMap *mod_map); void register_mystery_99(LPIModuleMap *mod_map); void register_mystery_e9(LPIModuleMap *mod_map); void register_mystery_qq(LPIModuleMap *mod_map); void register_n2ping(LPIModuleMap *mod_map); void register_natpmp(LPIModuleMap *mod_map); void register_netbios_udp(LPIModuleMap *mod_map); void register_netcat_cctv_udp(LPIModuleMap *mod_map); void register_netcore_scan(LPIModuleMap *mod_map); void register_netflow(LPIModuleMap *mod_map); void register_newerth(LPIModuleMap *mod_map); void register_nintendo(LPIModuleMap *mod_map); void register_noction(LPIModuleMap *mod_map); void register_noe(LPIModuleMap *mod_map); void register_norton(LPIModuleMap *mod_map); void register_ntp(LPIModuleMap *mod_map); void register_ntp_reflect(LPIModuleMap *mod_map); void register_nwn(LPIModuleMap *mod_map); void register_nvidia_gamestream(LPIModuleMap *mod_map); void register_opaserv(LPIModuleMap *mod_map); void register_openvpn_udp(LPIModuleMap *mod_map); void register_orbit_udp(LPIModuleMap *mod_map); void register_overwatch(LPIModuleMap *mod_map); void register_paladins(LPIModuleMap *mod_map); void register_pando_udp(LPIModuleMap *mod_map); void register_panipani(LPIModuleMap *mod_map); void register_planetside2(LPIModuleMap *mod_map); void register_portmap_rpc(LPIModuleMap *mod_map); void register_pplive(LPIModuleMap *mod_map); void register_ppstream(LPIModuleMap *mod_map); void register_probable_gnutella(LPIModuleMap *mod_map); void register_ps4_remoteplay(LPIModuleMap *mod_map); void register_psn(LPIModuleMap *mod_map); void register_punkbuster(LPIModuleMap *mod_map); void register_pyzor(LPIModuleMap *mod_map); void register_qq(LPIModuleMap *mod_map); void register_qqlive(LPIModuleMap *mod_map); void register_qqpcmgr(LPIModuleMap *mod_map); void register_qqspeedmobile_udp(LPIModuleMap *mod_map); void register_quake(LPIModuleMap *mod_map); void register_quic(LPIModuleMap *mod_map); void register_qvod_udp(LPIModuleMap *mod_map); void register_radius(LPIModuleMap *mod_map); void register_ramsey_dash(LPIModuleMap *mod_map); void register_rdp_udp(LPIModuleMap *mod_map); void register_real(LPIModuleMap *mod_map); void register_risingstorm(LPIModuleMap *mod_map); void register_raknet(LPIModuleMap *mod_map); void register_robocraft(LPIModuleMap *mod_map); void register_rocket_league(LPIModuleMap *mod_map); void register_rrshare(LPIModuleMap *mod_map); void register_rtcp(LPIModuleMap *mod_map); void register_rtmfp(LPIModuleMap *mod_map); void register_rtp(LPIModuleMap *mod_map); void register_rulesofsurvival(LPIModuleMap *mod_map); void register_sanandreas_mp(LPIModuleMap *mod_map); void register_second_life_udp(LPIModuleMap *mod_map); void register_serialnumberd(LPIModuleMap *mod_map); void register_sip_udp(LPIModuleMap *mod_map); void register_skype(LPIModuleMap *mod_map); void register_slp(LPIModuleMap *mod_map); void register_smite(LPIModuleMap *mod_map); void register_snapvpn(LPIModuleMap *mod_map); void register_snmp(LPIModuleMap *mod_map); void register_sopcast(LPIModuleMap *mod_map); void register_spamfighter(LPIModuleMap *mod_map); void register_spotify_bcast(LPIModuleMap *mod_map); void register_sql_worm(LPIModuleMap *mod_map); void register_ssdp(LPIModuleMap *mod_map); void register_starcitizen(LPIModuleMap *mod_map); void register_starcraft(LPIModuleMap *mod_map); void register_starleaf(LPIModuleMap *mod_map); void register_steamfriends(LPIModuleMap *mod_map); void register_steam_inhomebroadcast(LPIModuleMap *mod_map); void register_steam_localbroadcast(LPIModuleMap *mod_map); void register_steam_udp(LPIModuleMap *mod_map); void register_storm_worm(LPIModuleMap *mod_map); void register_stun(LPIModuleMap *mod_map); void register_syslog(LPIModuleMap *mod_map); void register_talesrunner_udp(LPIModuleMap *mod_map); void register_teamspeak(LPIModuleMap *mod_map); void register_teamviewer_udp(LPIModuleMap *mod_map); void register_teredo(LPIModuleMap *mod_map); void register_tf2(LPIModuleMap *mod_map); void register_tftp(LPIModuleMap *mod_map); void register_thecrew(LPIModuleMap *mod_map); void register_thq(LPIModuleMap *mod_map); void register_torchlight2(LPIModuleMap *mod_map); void register_tox(LPIModuleMap *mod_map); void register_traceroute(LPIModuleMap *mod_map); void register_tremulous(LPIModuleMap *mod_map); void register_turbovpn(LPIModuleMap *mod_map); void register_tvants(LPIModuleMap *mod_map); void register_ubisoft_games(LPIModuleMap *mod_map); void register_udp_no_payload(LPIModuleMap *mod_map); void register_umeye(LPIModuleMap *mod_map); void register_unreal(LPIModuleMap *mod_map); void register_ventrilo(LPIModuleMap *mod_map); void register_viber_udp(LPIModuleMap *mod_map); void register_vivox(LPIModuleMap *mod_map); void register_vpnmaster(LPIModuleMap *mod_map); void register_vpnrobot_udp(LPIModuleMap *mod_map); void register_vxworks_exploit(LPIModuleMap *mod_map); void register_warthunder(LPIModuleMap *mod_map); void register_webex(LPIModuleMap *mod_map); void register_wechat_udp(LPIModuleMap *mod_map); void register_winmessage(LPIModuleMap *mod_map); void register_wireguard(LPIModuleMap *mod_map); void register_wolfet(LPIModuleMap *mod_map); void register_worm_22105(LPIModuleMap *mod_map); void register_xfire_p2p(LPIModuleMap *mod_map); void register_xlsp(LPIModuleMap *mod_map); void register_xunlei_jsq(LPIModuleMap *mod_map); void register_xunlei_udp(LPIModuleMap *mod_map); void register_xunyou(LPIModuleMap *mod_map); void register_youdao_dict(LPIModuleMap *mod_map); void register_youku_udp(LPIModuleMap *mod_map); void register_yuanfudao(LPIModuleMap *mod_map); void register_yy_udp(LPIModuleMap *mod_map); void register_zalo_call(LPIModuleMap *mod_map); void register_zeroaccess_udp(LPIModuleMap *mod_map); void register_zoom(LPIModuleMap *mod_map); #endif ================================================ FILE: rpm/libprotoident.spec ================================================ Name: libprotoident Version: 2.0.15 Release: 2%{?dist} Summary: C/C++ Library for performing lightweight traffic classification License: LGPLv3 URL: https://github.com/wanduow/libprotoident Source0: https://github.com/wanduow/libprotoident/archive/%{version}.tar.gz BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: make BuildRequires: libtrace4-devel BuildRequires: libflowmanager-devel Provides: libprotoident %description libprotoident is a library that can perform traffic classification on each network flow observed via a packet capture process (including pcap trace files and many common live packet capture approaches). The classification is performed by examining the packet headers and first four bytes of application payload only, so can be used in environments where full payload capture is not possible. libprotoident is developed by the WAND Network Research Group at Waikato University in New Zealand. %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} %description devel The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %package tools Summary: Example software utilities for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} %description tools The %{name}-tools package contains example utilities that make use of the %{name} library. %prep %setup -q -n libprotoident-%{version} %build %configure --disable-static make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT %make_install find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %license COPYING %{_libdir}/libprotoident.so.* %files devel %{_includedir}/libprotoident* %{_libdir}/libprotoident.so %files tools %{_bindir}/* %{_mandir}/man1/* %changelog * Mon Mar 29 2021 Shane Alcock - 2.0.15-2 - Rebuild package to be compatible with latest libtrace * Thu Nov 12 2020 Shane Alcock - 2.0.15-1 - First libprotoident RPM package ================================================ FILE: rpmpkg-build.sh ================================================ #!/bin/bash set -x -e -o pipefail export QA_RPATHS=$[ 0x0001 ] SOURCENAME=`echo ${GITHUB_REF##*/} | cut -d '-' -f 1` ./bootstrap.sh && ./configure && make dist cp libprotoident-*.tar.gz ~/rpmbuild/SOURCES/${SOURCENAME}.tar.gz cp rpm/libprotoident.spec ~/rpmbuild/SPECS/ cd ~/rpmbuild && rpmbuild -bb --define "debug_package %{nil}" SPECS/libprotoident.spec ================================================ FILE: rpmpkg-setup.sh ================================================ #!/bin/bash set -x -e -o pipefail DISTRO=fedora if [ "$1" = "centos:8" ]; then DISTRO=centos fi if [ "$1" = "centos:7" ]; then DISTRO=centos fi mkdir -p /run/user/${UID} chmod 0700 /run/user/${UID} yum install -y wget make gcc curl -1sLf \ 'https://dl.cloudsmith.io/public/wand/libwandio/cfg/setup/bash.rpm.sh' \ | bash curl -1sLf \ 'https://dl.cloudsmith.io/public/wand/libwandder/cfg/setup/bash.rpm.sh' \ | bash curl -1sLf \ 'https://dl.cloudsmith.io/public/wand/libtrace/cfg/setup/bash.rpm.sh' \ | bash curl -1sLf \ 'https://dl.cloudsmith.io/public/wand/libflowmanager/cfg/setup/bash.rpm.sh' \ | bash yum update -y if [ "$1" = "centos:8" ]; then yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm || true dnf install -y 'dnf-command(config-manager)' || true yum config-manager --set-enabled PowerTools || true yum config-manager --set-enabled powertools || true fi if [ "$1" = "centos:7" ]; then yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm || true fi if [[ "$1" =~ fedora* ]]; then dnf install -y rpm-build rpmdevtools 'dnf-command(builddep)' which dnf group install -y "C Development Tools and Libraries" dnf builddep -y rpm/libprotoident.spec else yum install -y rpm-build yum-utils rpmdevtools which yum groupinstall -y 'Development Tools' yum-builddep -y rpm/libprotoident.spec fi rpmdev-setuptree ================================================ FILE: test/lpi_test_results ================================================ HTTP 69.105.38.213 42.172.118.65 3540 443 6 1168819201.135 158 0 48545450 HTTP 53 00000000 .... 0 HTTPS 69.105.38.213 42.172.118.67 3541 443 6 1168819201.165 7 0 15030100 .... 7 00000000 .... 0 No_Payload 69.105.38.213 42.172.118.66 3542 443 6 1168819201.185 0 0 00000000 .... 0 00000000 .... 0 HTTP 69.105.38.213 42.172.118.65 3543 443 6 1168819201.204 158 0 48545450 HTTP 53 00000000 .... 0 HTTP 61.27.66.223 69.105.13.23 1362 80 6 1168819201.076 450 430 48545450 HTTP 450 47455420 GET. 430 HTTP 61.24.28.192 69.105.13.23 50078 80 6 1168819201.160 589 278 48545450 HTTP 589 47455420 GET. 278 HTTP 69.105.2.222 42.135.12.22 37494 80 6 1168819201.222 249 782 48545450 HTTP 249 47455420 GET. 782 HTTP 255.241.81.173 69.105.13.23 50388 80 6 1168819201.027 10676 320 48545450 HTTP 1380 47455420 GET. 320 HTTP 42.187.208.120 69.105.13.23 1230 80 6 1168819201.216 1740 203 48545450 HTTP 1380 47455420 GET. 203 HTTP 61.27.66.223 69.105.13.23 1364 80 6 1168819201.254 457 430 48545450 HTTP 457 47455420 GET. 430 HTTP 61.24.28.192 69.105.13.23 50079 80 6 1168819201.327 385 282 48545450 HTTP 385 47455420 GET. 282 HTTP 255.241.81.173 69.105.13.23 50389 80 6 1168819201.335 225 396 48545450 HTTP 225 47455420 GET. 396 HTTP 50.60.128.26 69.105.13.23 49168 80 6 1168819201.566 1239 302 48545450 HTTP 1239 47455420 GET. 302 HTTP 69.105.2.222 42.135.12.22 51143 80 6 1168819201.535 249 767 48545450 HTTP 249 47455420 GET. 767 HTTP 69.105.2.222 42.66.23.42 33062 80 6 1168819201.172 4831 386 48545450 HTTP 1380 47455420 GET. 386 HTTP 69.105.2.156 42.135.12.22 43976 80 6 1168819201.566 2148 1682 48545450 HTTP 1368 47455420 GET. 1368 HTTP 255.241.81.173 69.105.13.23 50390 80 6 1168819201.505 225 400 48545450 HTTP 225 47455420 GET. 400 HTTP 69.105.207.210 43.196.4.116 56144 80 6 1168819201.099 27333 1178 48545450 HTTP 1368 47455420 GET. 571 HTTP 69.105.2.222 42.66.23.42 54460 80 6 1168819201.248 3671 392 48545450 HTTP 1380 47455420 GET. 392 HTTP 61.24.28.192 69.105.13.23 50080 80 6 1168819201.492 7102 293 48545450 HTTP 1380 47455420 GET. 293 HTTP_P2P 69.105.2.157 61.25.79.77 2048 50626 6 1168819201.024 1256 4830 47455420 GET. 1256 48545450 HTTP 392 HTTP 69.105.2.156 68.75.61.253 58721 80 6 1168819201.707 280 755 48545450 HTTP 280 47455420 GET. 755 HTTP_P2P 69.105.2.157 61.25.79.77 2048 50627 6 1168819201.088 1262 3670 47455420 GET. 1262 48545450 HTTP 391 HTTP 69.105.207.210 43.196.35.168 56147 80 6 1168819201.795 261 637 48545450 HTTP 261 47455420 GET. 637 HTTP 255.241.81.173 69.105.13.23 50391 80 6 1168819201.669 225 401 48545450 HTTP 225 47455420 GET. 401 HTTP 69.105.2.156 140.151.237.178 33454 80 6 1168819201.557 1424 1462 48545450 HTTP 1356 47455420 GET. 1368 HTTP 255.241.81.173 69.105.13.23 50392 80 6 1168819201.834 224 397 48545450 HTTP 224 47455420 GET. 397 HTTP 69.105.2.222 42.135.12.22 35425 80 6 1168819201.093 247 783 48545450 HTTP 247 47455420 GET. 783 HTTP 69.105.166.211 43.203.57.1 39658 80 6 1168819201.918 164 616 48545450 HTTP 113 47455420 GET. 616 HTTP 69.105.166.211 42.45.160.211 39659 80 6 1168819202.012 146 560 48545450 HTTP 146 47455420 GET. 560 HTTP 61.24.28.192 69.105.13.23 50081 80 6 1168819201.737 10324 293 48545450 HTTP 1380 47455420 GET. 293 HTTP 69.105.166.211 42.45.160.211 39660 80 6 1168819202.069 147 396 48545450 HTTP 147 47455420 GET. 396 HTTP 255.241.81.173 69.105.13.23 50393 80 6 1168819201.998 224 399 48545450 HTTP 224 47455420 GET. 399 HTTP 69.105.166.211 42.45.160.211 39661 80 6 1168819202.115 147 394 48545450 HTTP 147 47455420 GET. 394 HTTP 69.105.166.211 42.45.160.211 39662 80 6 1168819202.139 147 395 48545450 HTTP 147 47455420 GET. 395 HTTP 69.105.2.222 42.135.12.22 38122 80 6 1168819201.335 739 777 48545450 HTTP 739 47455420 GET. 777 HTTP 69.105.166.211 42.45.160.211 39663 80 6 1168819202.219 147 395 48545450 HTTP 147 47455420 GET. 395 HTTP 49.26.100.21 69.105.203.31 30715 80 6 1168819201.634 2505 319 48545450 HTTP 1380 47455420 GET. 319 HTTP 69.105.166.211 42.45.160.211 39664 80 6 1168819202.272 146 396 48545450 HTTP 146 47455420 GET. 396 HTTP 69.105.2.222 42.66.23.42 41437 80 6 1168819201.911 787 396 48545450 HTTP 713 47455420 GET. 396 HTTP 69.105.2.222 42.66.23.42 52211 80 6 1168819201.990 767 400 48545450 HTTP 693 47455420 GET. 400 HTTP 69.105.2.156 42.135.12.22 33524 80 6 1168819201.672 2861 1682 48545450 HTTP 1368 47455420 GET. 1368 HTTP 61.24.28.192 69.105.13.23 50082 80 6 1168819202.071 14161 293 48545450 HTTP 1380 47455420 GET. 293 HTTP_P2P 69.105.2.157 61.25.79.77 2048 50628 6 1168819201.740 1266 786 47455420 GET. 1266 48545450 HTTP 390 HTTP_P2P 69.105.2.157 61.25.79.77 2048 50629 6 1168819201.834 1270 766 47455420 GET. 1270 48545450 HTTP 390 HTTP 69.105.166.211 43.203.57.1 39665 80 6 1168819202.365 164 620 48545450 HTTP 113 47455420 GET. 620 HTTP 69.105.166.211 42.45.160.211 39666 80 6 1168819202.382 146 396 48545450 HTTP 146 47455420 GET. 396 HTTP 61.24.28.192 69.105.13.23 50083 80 6 1168819202.382 10676 293 48545450 HTTP 1380 47455420 GET. 293 HTTP 69.105.166.211 43.203.57.1 39668 80 6 1168819202.690 164 622 48545450 HTTP 113 47455420 GET. 622 SMTP 192.163.40.130 69.105.2.89 62927 25 6 1168819201.178 315 1465 32323020 220. 38 45484c4f EHLO 50 HTTP 255.241.81.173 69.105.13.23 50394 80 6 1168819202.167 61259 396 48545450 HTTP 1380 47455420 GET. 396 HTTP 69.105.166.211 42.45.160.211 39669 80 6 1168819202.719 1443 328 48545450 HTTP 1380 47455420 GET. 328 HTTP 49.26.100.21 69.105.203.31 30714 80 6 1168819201.634 9900 319 48545450 HTTP 1380 47455420 GET. 319 HTTP 61.24.28.192 69.105.13.23 50084 80 6 1168819202.692 761 280 48545450 HTTP 761 47455420 GET. 280 HTTP 69.105.2.222 42.66.23.42 50195 80 6 1168819202.562 1735 390 48545450 HTTP 1380 47455420 GET. 390 HTTP 255.241.81.173 69.105.13.23 50395 80 6 1168819202.794 224 396 48545450 HTTP 224 47455420 GET. 396 HTTP 255.241.81.173 69.105.13.23 50396 80 6 1168819202.813 224 401 48545450 HTTP 224 47455420 GET. 401 HTTP_P2P 69.105.2.157 61.25.79.77 2048 50630 6 1168819202.419 1260 1734 47455420 GET. 1260 48545450 HTTP 391 HTTP 69.105.2.222 42.66.23.42 59418 80 6 1168819202.637 1733 392 48545450 HTTP 1380 47455420 GET. 392 HTTP 44.44.186.14 69.105.203.84 57293 80 6 1168819201.758 42225 266 48545450 HTTP 1380 47455420 GET. 266 HTTP 61.24.28.192 69.105.13.23 50070 80 6 1168819202.849 1200 284 48545450 HTTP 1200 47455420 GET. 284 HTTP 61.24.28.192 69.105.13.23 50085 80 6 1168819202.870 1239 284 48545450 HTTP 1239 47455420 GET. 284 HTTP 50.60.128.26 69.105.13.23 49154 80 6 1168819203.086 391 302 48545450 HTTP 391 47455420 GET. 302 HTTP 69.105.166.211 43.203.57.1 39671 80 6 1168819203.054 164 617 48545450 HTTP 113 47455420 GET. 617 HTTP 50.60.128.26 69.105.13.23 49193 80 6 1168819203.107 496 299 48545450 HTTP 496 47455420 GET. 299 HTTP 50.60.128.26 69.105.13.23 49195 80 6 1168819203.131 522 304 48545450 HTTP 522 47455420 GET. 304 HTTP 69.105.166.211 43.203.57.1 39672 80 6 1168819203.102 164 617 48545450 HTTP 113 47455420 GET. 617 HTTP 255.241.81.173 69.105.13.23 50397 80 6 1168819202.998 1740 219 48545450 HTTP 1380 47455420 GET. 219 HTTP_P2P 69.105.2.157 61.25.79.77 2048 50631 6 1168819202.423 1262 1732 47455420 GET. 1262 48545450 HTTP 391 HTTP 255.241.81.173 69.105.13.23 50398 80 6 1168819203.021 225 405 48545450 HTTP 225 47455420 GET. 405 HTTP 50.60.128.26 69.105.13.23 49198 80 6 1168819203.180 225 395 48545450 HTTP 225 47455420 GET. 395 HTTP 69.105.207.210 197.120.55.199 56150 80 6 1168819202.936 1500 1510 48545450 HTTP 1368 47455420 GET. 1368 HTTP 61.24.28.192 69.105.13.23 50087 80 6 1168819203.128 391 284 48545450 HTTP 391 47455420 GET. 284 HTTP 255.241.81.173 69.105.13.23 50399 80 6 1168819203.164 225 409 48545450 HTTP 225 47455420 GET. 409 HTTP 255.241.81.173 69.105.13.23 50400 80 6 1168819203.191 225 414 48545450 HTTP 225 47455420 GET. 414 SMTP 192.92.41.11 69.105.2.232 4591 25 6 1168819202.446 65 7 32323020 220. 38 45484c4f EHLO 7 HTTP 69.105.166.211 43.203.57.1 39674 80 6 1168819203.342 164 622 48545450 HTTP 113 47455420 GET. 622 SMTP 43.94.176.178 69.105.2.232 33986 25 6 1168819201.821 340 116361 32323020 220. 38 45484c4f EHLO 25 HTTP 69.105.2.222 42.135.12.22 58067 80 6 1168819203.346 249 778 48545450 HTTP 249 47455420 GET. 778 HTTP 255.241.81.173 69.105.13.23 50401 80 6 1168819203.330 225 408 48545450 HTTP 225 47455420 GET. 408 HTTP 43.82.63.173 69.105.13.23 2457 80 6 1168819203.416 12070 273 48545450 HTTP 1380 47455420 GET. 273 HTTP 255.241.81.173 69.105.13.23 50402 80 6 1168819203.360 225 405 48545450 HTTP 225 47455420 GET. 405 HTTP 69.105.2.222 42.66.23.42 44762 80 6 1168819203.153 1696 394 48545450 HTTP 1380 47455420 GET. 394 HTTP 69.105.197.19 59.103.17.103 50525 80 6 1168819203.451 149 142 48545450 HTTP 149 47455420 GET. 63 HTTP 61.24.28.192 69.105.13.23 50088 80 6 1168819203.287 12070 251 48545450 HTTP 1380 47455420 GET. 251 HTTP_P2P 69.105.2.157 61.25.79.77 2048 50632 6 1168819203.011 1264 1695 47455420 GET. 1264 48545450 HTTP 391 HTTP 69.105.197.19 59.103.17.103 50526 80 6 1168819203.557 145 138 48545450 HTTP 145 47455420 GET. 59 HTTP 69.105.2.222 42.66.23.42 35107 80 6 1168819203.305 1746 395 48545450 HTTP 1380 47455420 GET. 395 HTTP 69.105.2.222 42.135.12.22 38820 80 6 1168819203.490 3808 705 48545450 HTTP 1368 47455420 GET. 705 HTTP 43.82.63.173 69.105.13.23 2458 80 6 1168819203.597 227 385 48545450 HTTP 227 47455420 GET. 385 HTTP 43.82.63.173 69.105.13.23 2459 80 6 1168819203.605 226 385 48545450 HTTP 226 47455420 GET. 385 HTTP 69.105.2.222 42.135.12.22 44343 80 6 1168819203.231 249 773 48545450 HTTP 249 47455420 GET. 773 HTTP 69.105.197.19 59.103.17.103 50527 80 6 1168819203.626 148 146 48545450 HTTP 148 47455420 GET. 67 HTTP 255.241.81.173 69.105.13.23 50403 80 6 1168819203.514 225 405 48545450 HTTP 225 47455420 GET. 405 HTTP 61.24.28.192 69.105.13.23 50086 80 6 1168819203.076 61259 279 48545450 HTTP 1380 47455420 GET. 279 HTTP 43.82.63.173 69.105.13.23 2460 80 6 1168819203.640 227 383 48545450 HTTP 227 47455420 GET. 383 HTTP 69.105.197.19 59.103.17.103 50528 80 6 1168819203.664 145 142 48545450 HTTP 145 47455420 GET. 63 HTTP 43.82.63.173 69.105.13.23 2461 80 6 1168819203.667 225 390 48545450 HTTP 225 47455420 GET. 390 HTTP 43.82.63.173 69.105.13.23 2462 80 6 1168819203.702 225 402 48545450 HTTP 225 47455420 GET. 402 HTTP 69.105.197.19 59.103.17.103 50529 80 6 1168819203.706 148 145 48545450 HTTP 148 47455420 GET. 66 HTTP_P2P 69.105.2.157 61.25.79.77 2048 50633 6 1168819203.165 1265 1745 47455420 GET. 1265 48545450 HTTP 391 HTTP 61.24.28.192 69.105.13.23 50089 80 6 1168819203.624 522 286 48545450 HTTP 522 47455420 GET. 286 Razor 197.99.150.3 69.105.197.16 2703 48967 6 1168819203.060 29 117 613d6726 a=g& 12 736e3d44 sn=D 35 HTTP 43.82.63.173 69.105.13.23 2464 80 6 1168819203.750 227 379 48545450 HTTP 227 47455420 GET. 379 HTTP 43.82.63.173 69.105.13.23 2463 80 6 1168819203.725 42927 298 48545450 HTTP 1380 47455420 GET. 298 Razor 197.99.150.3 69.105.2.155 2703 33279 6 1168819203.088 29 117 613d6726 a=g& 12 736e3d44 sn=D 35 HTTP 61.24.28.192 69.105.13.23 50090 80 6 1168819203.676 496 281 48545450 HTTP 496 47455420 GET. 281 HTTP 43.82.63.173 69.105.13.23 2465 80 6 1168819203.830 226 390 48545450 HTTP 226 47455420 GET. 390 HTTP 43.82.63.173 69.105.13.23 2466 80 6 1168819203.852 224 385 48545450 HTTP 224 47455420 GET. 385 HTTP 43.82.63.173 69.105.13.23 2467 80 6 1168819203.883 225 379 48545450 HTTP 225 47455420 GET. 379 HTTP 43.82.63.173 69.105.13.23 2468 80 6 1168819203.895 226 381 48545450 HTTP 226 47455420 GET. 381 SMTP 193.132.251.169 69.105.2.232 51073 25 6 1168819201.628 357 108 32323020 220. 38 45484c4f EHLO 44 HTTP 43.82.63.173 69.105.13.23 2469 80 6 1168819203.931 225 398 48545450 HTTP 225 47455420 GET. 398 HTTP 43.82.63.173 69.105.13.23 2470 80 6 1168819203.957 226 378 48545450 HTTP 226 47455420 GET. 378 HTTP 61.24.28.192 69.105.13.23 50092 80 6 1168819203.835 1583 272 48545450 HTTP 1380 47455420 GET. 272 HTTP 50.60.128.26 69.105.13.23 49207 80 6 1168819203.991 225 400 48545450 HTTP 225 47455420 GET. 400 No_Payload 69.105.197.22 34.181.123.167 59351 113 6 1168819203.487 0 0 00000000 .... 0 00000000 .... 0 HTTP 43.82.63.173 69.105.13.23 2471 80 6 1168819203.981 225 383 48545450 HTTP 225 47455420 GET. 383 HTTP 61.24.28.192 69.105.13.23 50091 80 6 1168819203.780 10329 271 48545450 HTTP 1380 47455420 GET. 271 HTTP 69.105.2.222 42.66.23.42 34544 80 6 1168819203.747 1271 401 48545450 HTTP 1197 47455420 GET. 401 No_Payload 69.105.197.22 34.181.123.167 42334 113 6 1168819203.642 0 0 00000000 .... 0 00000000 .... 0 HTTP_P2P 69.105.2.157 61.25.79.77 2048 50634 6 1168819203.606 1271 1270 47455420 GET. 1271 48545450 HTTP 390 HTTP 69.105.2.222 42.66.23.42 42954 80 6 1168819203.905 1411 387 48545450 HTTP 1337 47455420 GET. 387 HTTP 61.24.28.192 69.105.13.23 50093 80 6 1168819204.000 7192 269 48545450 HTTP 1380 47455420 GET. 269 SMTP 193.132.251.169 69.105.2.232 51079 25 6 1168819202.592 357 108 32323020 220. 38 45484c4f EHLO 44 HTTP 61.24.28.192 69.105.13.23 50094 80 6 1168819204.101 6574 265 48545450 HTTP 1380 47455420 GET. 265 HTTP_P2P 69.105.2.157 61.25.79.77 2048 50635 6 1168819203.761 1256 1410 47455420 GET. 1256 48545450 HTTP 390 HTTP 61.24.28.192 69.105.13.23 50095 80 6 1168819204.237 371 267 48545450 HTTP 371 47455420 GET. 267 HTTP 39.171.180.203 56.147.60.139 59590 80 6 1168819201.211 806 2732 48545450 HTTP 422 47455420 GET. 1351 HTTP 61.24.28.192 69.105.13.23 50096 80 6 1168819204.344 467 278 48545450 HTTP 467 47455420 GET. 278 HTTP 50.60.128.26 69.105.13.23 49212 80 6 1168819204.479 225 382 48545450 HTTP 225 47455420 GET. 382 HTTP 58.90.180.7 69.105.13.23 3216 80 6 1168819201.553 226 310 48545450 HTTP 226 47455420 GET. 310 HTTP 39.171.180.203 43.26.228.234 4066 80 6 1168819204.484 405 858 48545450 HTTP 405 47455420 GET. 858 HTTP 49.26.100.21 69.105.203.31 30713 80 6 1168819201.630 121763 313 48545450 HTTP 1380 47455420 GET. 313 HTTP 50.60.128.26 69.105.13.23 49214 80 6 1168819204.506 225 394 48545450 HTTP 225 47455420 GET. 394 HTTP 58.90.180.7 69.105.13.23 3217 80 6 1168819201.943 226 310 48545450 HTTP 226 47455420 GET. 310 HTTP 69.105.207.210 38.155.150.139 56148 80 6 1168819202.104 137 545 48545450 HTTP 137 47455420 GET. 545 HTTP 61.24.28.192 69.105.13.23 50097 80 6 1168819204.396 773 268 48545450 HTTP 773 47455420 GET. 268 SMTP 213.232.228.16 69.105.2.89 3604 25 6 1168819202.491 395 109 32323020 220. 38 45484c4f EHLO 48 HTTP 50.60.128.26 69.105.13.23 49171 80 6 1168819201.637 75059 297 48545450 HTTP 1380 47455420 GET. 297 Razor 197.99.150.3 69.105.2.232 2703 52428 6 1168819203.857 29 117 613d6726 a=g& 12 736e3d44 sn=D 35 Razor 197.99.150.3 69.105.2.155 2703 33283 6 1168819203.861 29 117 613d6726 a=g& 12 736e3d44 sn=D 35 No_Payload 50.105.44.11 69.105.144.66 51000 80 6 1168819201.445 0 0 00000000 .... 0 00000000 .... 0 No_Payload 43.82.22.227 69.105.166.144 3627 135 6 1168819201.485 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.32.147 209.115.210.85 4662 63050 6 1168819201.655 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.230.150 215.8.24.93 1378 7961 6 1168819201.692 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.230.150 195.192.73.13 1381 5522 6 1168819201.793 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.40.14 210.206.213.132 2845 58716 6 1168819201.822 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.2.156 44.136.40.214 47758 80 6 1168819202.031 0 0 00000000 .... 0 00000000 .... 0 No_Payload 40.226.64.253 69.105.221.32 3594 8532 6 1168819202.147 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.2.156 42.135.12.22 37950 80 6 1168819202.191 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.40.14 208.99.97.166 2852 6881 6 1168819202.259 0 0 00000000 .... 0 00000000 .... 0 No_Payload 143.192.185.25 69.105.230.150 4416 7226 6 1168819202.285 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.2.222 42.135.12.22 48557 80 6 1168819202.294 0 0 00000000 .... 0 00000000 .... 0 No_Payload 43.205.240.253 69.105.13.23 2113 389 6 1168819202.350 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.40.14 204.165.104.105 2854 57977 6 1168819202.369 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.2.156 42.135.12.22 53091 80 6 1168819202.382 0 0 00000000 .... 0 00000000 .... 0 No_Payload 53.124.123.22 69.105.198.83 55050 8080 6 1168819202.384 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.230.150 61.86.232.141 1380 11883 6 1168819202.397 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.230.150 59.121.65.165 1383 26284 6 1168819202.497 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.54.27 168.110.170.169 3528 35095 6 1168819202.640 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.230.150 58.216.221.222 2929 1274 6 1168819202.732 0 0 00000000 .... 0 00000000 .... 0 HTTP 69.105.2.156 199.243.87.232 42343 80 6 1168819202.134 3469 515 48545450 HTTP 1380 47455420 GET. 515 No_Payload 40.116.114.47 39.171.178.209 1088 135 6 1168819202.880 0 0 00000000 .... 0 00000000 .... 0 No_Payload 213.229.187.254 69.105.144.67 3129 9990 6 1168819203.040 0 0 00000000 .... 0 00000000 .... 0 No_Payload 255.241.72.45 69.105.167.158 50702 8080 6 1168819203.128 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.40.14 212.75.92.249 2847 6881 6 1168819203.134 0 0 00000000 .... 0 00000000 .... 0 HTTP 69.105.2.156 42.135.12.22 35736 80 6 1168819202.723 2600 1682 48545450 HTTP 1368 47455420 GET. 1368 No_Payload 202.4.202.110 69.105.159.221 44493 80 6 1168819203.319 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.40.14 214.22.233.15 2848 6881 6 1168819203.353 0 0 00000000 .... 0 00000000 .... 0 No_Payload 213.160.138.228 39.171.178.236 4216 135 6 1168819203.535 0 0 00000000 .... 0 00000000 .... 0 No_Payload 213.171.117.61 39.171.180.64 3376 139 6 1168819203.614 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.230.150 59.249.110.59 4569 21253 6 1168819203.621 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.2.222 42.135.12.22 48724 80 6 1168819203.640 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.54.27 40.122.148.65 3530 7331 6 1168819203.688 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.197.19 59.103.17.103 50530 80 6 1168819203.755 0 0 00000000 .... 0 00000000 .... 0 HTTP 69.105.2.158 56.147.60.139 41907 80 6 1168819201.877 363 1492 48545450 HTTP 363 504f5354 POST 1380 No_Payload 39.171.180.67 199.3.190.9 2967 52274 6 1168819203.959 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.40.14 199.67.131.1 2853 6881 6 1168819204.009 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.198.215 69.241.82.212 2967 2515 6 1168819204.089 0 0 00000000 .... 0 00000000 .... 0 No_Payload 59.113.121.94 69.105.230.150 2353 1331 6 1168819204.269 0 0 00000000 .... 0 00000000 .... 0 No_Payload 168.70.248.52 39.171.178.151 4055 139 6 1168819201.354 0 0 00000000 .... 0 00000000 .... 0 HTTP 50.60.128.26 69.105.13.23 49210 80 6 1168819204.208 1545 298 48545450 HTTP 1380 47455420 GET. 298 No_Payload 193.202.51.30 69.105.2.232 2703 59660 6 1168819204.468 0 0 00000000 .... 0 00000000 .... 0 No_Payload 193.202.51.30 69.105.2.155 2703 38111 6 1168819204.483 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.2.222 42.66.23.42 45655 80 6 1168819204.503 0 0 00000000 .... 0 00000000 .... 0 No_Payload 143.219.132.229 69.105.230.150 62868 7226 6 1168819201.504 0 0 00000000 .... 0 00000000 .... 0 No_Payload 81.221.140.10 69.105.157.97 1525 139 6 1168819204.517 0 0 00000000 .... 0 00000000 .... 0 No_Payload 193.202.51.30 69.105.2.155 2703 38112 6 1168819204.535 0 0 00000000 .... 0 00000000 .... 0 No_Payload 197.99.150.3 69.105.197.16 2703 48977 6 1168819204.554 0 0 00000000 .... 0 00000000 .... 0 No_Payload 197.99.150.3 69.105.2.155 2703 33288 6 1168819204.578 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.166.211 199.79.21.102 39683 80 6 1168819204.586 0 0 00000000 .... 0 00000000 .... 0 HTTP 61.24.28.192 69.105.13.23 50098 80 6 1168819204.501 633 277 48545450 HTTP 633 47455420 GET. 277 No_Payload 69.105.207.210 38.155.150.139 56153 80 6 1168819204.605 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.228.124 62.151.12.159 4662 1258 6 1168819204.606 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.54.27 57.91.211.158 3529 16414 6 1168819201.678 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.2.222 42.135.12.22 51369 80 6 1168819201.625 0 0 00000000 .... 0 00000000 .... 0 HTTP 50.60.128.26 69.105.13.23 49218 80 6 1168819204.628 1599 307 48545450 HTTP 1380 47455420 GET. 307 HTTP 50.60.128.26 69.105.13.23 49219 80 6 1168819204.629 1487 311 48545450 HTTP 1380 47455420 GET. 311 HTTP 69.105.207.210 43.196.35.173 56145 80 6 1168819201.352 8144 567 48545450 HTTP 1368 47455420 GET. 567 HTTPS 69.105.166.81 50.61.130.251 2225 443 6 1168819201.653 6500 599 16030100 .... 1260 16030100 .... 110 HTTP 69.105.166.211 56.147.60.130 39657 80 6 1168819201.313 3518 819 48545450 HTTP 451 47455420 GET. 410 HTTP 69.105.2.156 106.181.195.94 39160 80 6 1168819201.560 1552 450 48545450 HTTP 273 47455420 GET. 450 HTTP 69.105.166.211 56.147.60.135 39656 80 6 1168819201.202 8038 819 48545450 HTTP 1380 47455420 GET. 410 HTTPS 50.60.128.108 69.105.2.197 39479 443 6 1168819202.263 775 650 16030000 .... 146 16030000 .... 102 HTTP 69.105.2.156 106.181.195.94 42149 80 6 1168819201.560 4181 1800 48545450 HTTP 272 47455420 GET. 450 HTTP 69.105.2.156 212.92.122.226 60856 80 6 1168819201.577 8836 295 48545450 HTTP 1380 47455420 GET. 295 No_Payload 143.102.194.141 69.105.2.89 58794 25 6 1168819201.499 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.2.156 199.243.87.232 56280 80 6 1168819202.644 0 0 00000000 .... 0 00000000 .... 0 No_Payload 69.105.2.156 198.56.122.188 57562 80 6 1168819202.770 0 0 00000000 .... 0 00000000 .... 0 HTTP 69.105.2.156 200.12.228.63 33145 80 6 1168819201.975 946 482 48545450 HTTP 946 47455420 GET. 482 POP3 69.105.197.38 59.103.27.16 56293 110 6 1168819202.911 2340 657 2b4f4b20 +OK. 82 43415041 CAPA 6 No_Payload 69.105.2.156 42.135.12.22 41183 80 6 1168819203.291 0 0 00000000 .... 0 00000000 .... 0 No_Payload 61.97.203.29 69.105.2.89 2008 25 6 1168819202.695 0 0 00000000 .... 0 00000000 .... 0 HTTP 69.105.2.156 106.181.195.94 39464 80 6 1168819201.890 67887 398 48545450 HTTP 295 47455420 GET. 398 BitTorrent 69.105.230.150 254.151.186.50 1382 23352 6 1168819202.195 0 68 00000000 .... 0 13426974 .Bit 68 SMTP 214.70.45.73 69.105.2.89 4685 25 6 1168819201.286 213 119 32323020 220. 38 45484c4f EHLO 49 SMTP 92.222.61.188 69.105.2.232 4393 25 6 1168819201.074 213 105 32323020 220. 38 45484c4f EHLO 37 SMTP 143.194.127.77 69.105.2.232 1553 25 6 1168819201.648 76 100 32323020 220. 38 48454c4f HELO 22 BitTorrent 69.105.230.150 142.212.118.180 1379 25492 6 1168819202.095 0 68 00000000 .... 0 13426974 .Bit 68 No_Payload 211.0.121.23 69.105.2.89 3681 25 6 1168819203.308 0 0 00000000 .... 0 00000000 .... 0 SMTP 209.18.37.173 69.105.2.89 2780 25 6 1168819202.279 213 112 32323020 220. 38 45484c4f EHLO 47 No_Payload 211.8.2.196 69.105.2.89 3424 25 6 1168819203.763 0 0 00000000 .... 0 00000000 .... 0 HTTPS 69.105.207.210 56.147.60.240 56149 443 6 1168819202.915 2215 1780 16030100 .... 1380 16030100 .... 116 No_Payload 215.203.191.54 69.105.2.232 3877 25 6 1168819203.846 0 0 00000000 .... 0 00000000 .... 0 HTTP 69.105.166.211 197.132.132.23 39675 80 6 1168819203.386 173 557 48545450 HTTP 173 47455420 GET. 557 No_Payload 69.105.38.213 42.172.118.66 3545 443 6 1168819203.836 0 0 00000000 .... 0 00000000 .... 0 HTTPS 69.105.207.210 197.120.58.3 56151 443 6 1168819203.243 6204 1793 16030100 .... 1070 16030100 .... 120 HTTPS 69.105.38.213 42.172.118.67 3544 443 6 1168819201.217 881 680 16030101 .... 352 802c0103 .,.. 46 No_Payload 218.25.239.167 69.105.2.232 3083 25 6 1168819203.449 0 0 00000000 .... 0 00000000 .... 0 No_Payload 168.88.184.178 69.105.2.89 2920 25 6 1168819202.956 0 0 00000000 .... 0 00000000 .... 0 HTTP_443 69.105.38.213 42.172.118.65 3546 443 6 1168819203.859 0 175 00000000 .... 0 47455420 GET. 175 No_Payload 209.176.6.159 69.105.2.232 4958 25 6 1168819202.824 0 0 00000000 .... 0 00000000 .... 0 HTTPS 143.87.24.19 69.105.2.197 31094 443 6 1168819202.070 35812 4675 16030000 .... 146 16030000 .... 102 No_Payload 38.118.77.114 69.105.2.232 3983 25 6 1168819203.752 0 0 00000000 .... 0 00000000 .... 0 No_Payload 45.86.130.6 69.105.2.232 51772 25 6 1168819203.982 0 0 00000000 .... 0 00000000 .... 0 HTTP 69.105.2.156 158.68.130.7 43885 80 6 1168819201.886 97128 388 48545450 HTTP 1368 47455420 GET. 388 No_Payload 208.166.58.33 69.105.2.232 1458 25 6 1168819204.146 0 0 00000000 .... 0 00000000 .... 0 SMTP 34.181.123.167 69.105.197.22 1238 25 6 1168819203.087 78 0 32323020 220. 78 00000000 .... 0 HTTPS 255.241.86.179 69.105.2.197 50222 443 6 1168819201.340 1943 1690 16030100 .... 122 16030100 .... 102 SMTP 213.245.4.62 69.105.2.89 3054 25 6 1168819202.597 199 227 32323020 220. 38 45484c4f EHLO 32 SMTP 42.53.76.173 69.105.2.232 51641 25 6 1168819203.265 213 134 32323020 220. 38 45484c4f EHLO 23 No_Payload 95.47.191.88 69.105.2.89 3258 25 6 1168819202.406 0 0 00000000 .... 0 00000000 .... 0 SMTP 213.164.56.161 69.105.2.232 3079 25 6 1168819202.615 393 106 32323020 220. 38 45484c4f EHLO 26 HTTP_P2P 69.105.2.157 61.25.79.77 2048 50636 6 1168819204.211 1261 0 47455420 GET. 1261 00000000 .... 0 SMTP 40.154.46.27 69.105.2.89 62211 25 6 1168819202.014 76 73 32323020 220. 38 48454c4f HELO 25 HTTP 255.243.186.75 69.105.2.157 10780 80 6 1168819204.220 0 2617 00000000 .... 0 504f5354 POST 1380 HTTP_P2P 69.105.2.157 61.25.79.77 2048 50637 6 1168819204.362 1255 0 47455420 GET. 1255 00000000 .... 0 No_Payload 209.18.37.173 69.105.2.89 2793 25 6 1168819204.134 0 0 00000000 .... 0 00000000 .... 0 HTTP 69.105.2.222 42.66.23.42 44915 80 6 1168819204.349 0 393 00000000 .... 0 47455420 GET. 393 SMTP 69.105.206.211 199.86.88.228 55595 25 6 1168819202.726 150 106 32323020 220. 39 45484c4f EHLO 32 HTTP 193.202.43.1 69.105.140.182 53388 80 6 1168819203.804 2736 483 48545450 HTTP 1368 47455420 GET. 483 SMTP 40.88.96.141 69.105.2.89 4698 25 6 1168819203.230 76 82 32323020 220. 38 48454c4f HELO 13 SMTP 36.83.190.6 69.105.2.232 16030 25 6 1168819203.910 38 0 32323020 220. 38 00000000 .... 0 SMTP 193.132.251.169 69.105.2.232 51091 25 6 1168819203.556 213 113 32323020 220. 38 45484c4f EHLO 44 No_Payload 47.224.244.229 69.105.206.211 60421 25 6 1168819204.518 0 0 00000000 .... 0 00000000 .... 0 HTTP 140.89.63.51 69.105.203.31 38259 80 6 1168819204.323 2858 348 48545450 HTTP 122 47455420 GET. 348 SMTP 193.132.251.169 69.105.2.232 51095 25 6 1168819204.341 38 0 32323020 220. 38 00000000 .... 0 Razor 197.99.150.3 69.105.2.155 2703 33284 6 1168819203.882 29 117 613d6726 a=g& 12 736e3d44 sn=D 35 HTTPS 143.87.24.19 69.105.2.197 31113 443 6 1168819204.476 146 102 16030000 .... 146 16030000 .... 102 HTTP 69.105.166.211 194.217.159.152 39679 80 6 1168819203.798 13800 534 48545450 HTTP 1380 47455420 GET. 534 No_Payload 61.97.211.112 69.105.2.89 60499 25 6 1168819201.624 0 0 00000000 .... 0 00000000 .... 0 Razor 193.202.51.30 69.105.197.16 2703 39112 6 1168819203.641 44 209 636e3d72 cn=r 25 736e3d43 sn=C 36 SMTP 200.199.138.121 69.105.166.216 2018 25 6 1168819203.904 53 75 32323020 220. 11 48454c4f HELO 39 HTTP 69.105.207.210 56.147.60.139 56152 80 6 1168819204.426 0 1787 00000000 .... 0 504f5354 POST 1380 SMTP 34.181.123.167 69.105.197.22 1237 25 6 1168819202.936 191 20 32323020 220. 78 45484c4f EHLO 20 HTTP 69.105.166.211 43.196.35.172 39682 80 6 1168819204.571 0 597 00000000 .... 0 47455420 GET. 597 Razor 193.202.51.30 69.105.2.155 2703 38105 6 1168819203.684 105 36 636e3d72 cn=r 25 736e3d43 sn=C 36 HTTP 69.105.207.210 140.92.148.70 56146 80 6 1168819201.464 7313 1176 48545450 HTTP 413 47455420 GET. 1176 HTTP 69.105.166.211 52.42.15.42 39681 80 6 1168819204.385 0 658 00000000 .... 0 47455420 GET. 658 HTTP 39.171.180.203 56.147.60.139 59591 80 6 1168819204.449 0 1477 00000000 .... 0 504f5354 POST 1460 SMTP 59.65.15.97 69.105.2.232 3947 25 6 1168819203.072 38 0 32323020 220. 38 00000000 .... 0 HTTP 69.105.166.211 52.42.15.42 39678 80 6 1168819203.769 6900 801 48545450 HTTP 1380 47455420 GET. 801 No_Payload 47.154.253.116 69.105.2.232 49839 25 6 1168819204.628 0 0 00000000 .... 0 00000000 .... 0 No_Payload 202.4.198.105 69.105.13.23 39991 80 6 1168819204.633 0 0 00000000 .... 0 00000000 .... 0 MSN 199.248.173.35 69.105.166.211 1863 39670 6 1168819202.913 200 107 55535220 USR. 59 55535220 USR. 37 No_Payload 61.24.28.192 69.105.13.23 50099 80 6 1168819204.571 0 0 00000000 .... 0 00000000 .... 0 No_Payload 193.132.251.169 69.105.2.232 51102 25 6 1168819204.638 0 0 00000000 .... 0 00000000 .... 0 HTTPS 59.103.173.17 69.105.166.218 1879 443 6 1168819203.023 4286 1619 16030000 .... 146 16030000 .... 102 HTTPS 255.243.247.179 69.105.2.197 50317 443 6 1168819204.334 3334 865 1603000a .... 1380 16030000 .... 102 No_Payload 35.20.159.19 39.171.180.118 1281 33434 17 1168819201.025 0 0 00000000 .... 0 00000000 .... 0 No_Payload 39.171.180.118 42.28.149.6 1281 33434 17 1168819201.028 0 0 00000000 .... 0 00000000 .... 0 DNS 69.105.13.2 38.14.110.251 36350 53 17 1168819201.033 175 0 c10a8480 .... 175 00000000 .... 0 DNS 69.105.2.89 56.200.226.189 37763 53 17 1168819201.036 300 0 cd098400 .... 150 00000000 .... 0 NTP 42.89.152.141 69.105.2.222 58407 123 17 1168819201.064 0 48 00000000 .... 0 1b000000 .... 48 DNS 69.105.2.232 52.34.247.29 14739 53 17 1168819201.066 99 0 90218400 .!.. 99 00000000 .... 0 DNS 69.105.2.232 56.200.226.189 9338 53 17 1168819201.104 304 0 5aaa8400 Z... 152 00000000 .... 0 DNS 69.105.2.232 199.163.9.10 30898 53 17 1168819201.105 0 43 00000000 .... 0 fd9e0000 .... 43 DNS 69.105.2.232 41.63.136.239 56450 53 17 1168819201.107 78 0 ac418000 .A.. 78 00000000 .... 0 Skype 69.105.166.211 70.211.67.192 39502 80 17 1168819201.117 29 0 ee8e0276 ...v 29 00000000 .... 0 DNS 69.105.2.232 38.248.134.10 41497 53 17 1168819201.120 208 0 c1638403 .c.. 104 00000000 .... 0 DNS 69.105.13.2 194.246.84.5 11385 53 17 1168819201.161 55 0 7af48403 z... 55 00000000 .... 0 No_Payload 39.171.180.97 42.67.167.68 1281 33434 17 1168819201.172 0 0 00000000 .... 0 00000000 .... 0 DNS 39.171.180.91 199.86.75.21 51730 53 17 1168819201.193 178 0 15918400 .... 89 00000000 .... 0 Unknown_UDP 69.105.2.89 37.237.12.249 2599 53 17 1168819201.195 258 0 df9c8080 .... 129 00000000 .... 0 DNS 69.105.13.2 39.199.110.30 15126 53 17 1168819201.198 113 0 3bcd8000 ;... 113 00000000 .... 0 DNS 69.105.2.232 37.30.33.6 63001 53 17 1168819201.203 438 0 33018400 3... 219 00000000 .... 0 DNS 69.105.2.232 48.246.25.188 42249 53 17 1168819201.204 95 0 fd1c8403 .... 95 00000000 .... 0 DNS 69.105.2.89 103.188.151.234 49115 53 17 1168819201.215 147 0 7b458000 {E.. 147 00000000 .... 0 BitTorrent_UDP 214.246.7.18 69.105.230.150 63696 7226 17 1168819201.216 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.2.232 194.236.28.177 25154 53 17 1168819201.221 820 0 73b88400 s... 410 00000000 .... 0 BitTorrent_UDP 38.189.80.15 69.105.230.150 63979 7226 17 1168819201.224 0 302 00000000 .... 0 64313a72 d1:r 302 DNS 69.105.13.2 41.61.249.207 36631 53 17 1168819201.231 207 0 8b6c8400 .l.. 207 00000000 .... 0 DNS 69.105.13.2 57.115.0.49 51889 53 17 1168819201.231 100 0 ade78403 .... 100 00000000 .... 0 DNS 69.105.2.232 42.12.225.56 38515 53 17 1168819201.194 100 45 77ed8403 w... 100 77ed0000 w... 45 DNS 69.105.13.2 39.213.161.1 55659 53 17 1168819201.290 304 0 e33f8000 .?.. 152 00000000 .... 0 DNS 69.105.2.89 38.131.236.181 21153 53 17 1168819201.299 153 0 f2b38480 .... 153 00000000 .... 0 DNS 69.105.2.89 39.253.2.254 27275 53 17 1168819201.299 159 0 953e8000 .>.. 159 00000000 .... 0 DNS 69.105.2.89 56.200.226.189 50663 53 17 1168819201.308 300 0 cd528400 .R.. 150 00000000 .... 0 BitTorrent_UDP 141.147.19.31 69.105.230.150 24589 7226 17 1168819201.304 0 1644 00000000 .... 0 64313a72 d1:r 822 DNS 69.105.13.2 192.138.252.113 65474 53 17 1168819201.313 0 26 00000000 .... 0 ea480000 .H.. 26 NTP 136.184.17.5 69.105.13.2 123 123 17 1168819201.313 0 48 00000000 .... 0 1b030aee .... 48 DNS 39.171.180.115 35.255.66.196 15282 53 17 1168819201.016 450 31 0e1f8000 .... 450 0e1f0000 .... 31 DNS 39.171.180.115 36.16.123.144 15282 53 17 1168819201.016 62 31 0e208400 .... 62 0e200000 .... 31 NTP 69.105.2.235 43.94.229.101 123 123 17 1168819201.326 48 0 1b0206ee .... 48 00000000 .... 0 DNS 69.105.2.232 41.95.129.43 54742 53 17 1168819201.326 91 0 141a8400 .... 91 00000000 .... 0 DNS 69.105.2.232 41.74.247.92 64444 53 17 1168819201.327 0 51 00000000 .... 0 50790000 Py.. 51 DNS 69.105.2.232 52.34.247.29 11263 53 17 1168819201.333 164 0 0a278400 .'.. 164 00000000 .... 0 DNS 69.105.13.2 46.121.197.244 48003 53 17 1168819201.199 129 29 aac98400 .... 129 aac90000 .... 29 DNS 69.105.2.232 70.252.78.13 19115 53 17 1168819201.162 95 49 0c2a8403 .*.. 95 0c2a0000 .*.. 49 DNS 69.105.2.232 46.117.175.43 17453 53 17 1168819201.225 105 32 8ebe8000 .... 105 8ebe0000 .... 32 ICMP 69.105.157.197 197.13.74.146 0 0 1 1168819201.384 33 0 00000000 .... 0 00000000 .... 0 ICMP 197.13.74.146 69.105.141.18 0 0 1 1168819201.385 0 33 00000000 .... 0 00000000 .... 0 NTP 61.27.224.71 69.105.13.2 123 123 17 1168819201.387 0 48 00000000 .... 0 0b000000 .... 48 ICMP 197.13.74.146 69.105.2.6 0 0 1 1168819201.389 0 33 00000000 .... 0 00000000 .... 0 ICMP 197.13.74.146 69.105.194.56 0 0 1 1168819201.396 0 33 00000000 .... 0 00000000 .... 0 BitTorrent_UDP 58.108.63.162 69.105.230.150 4365 7226 17 1168819201.396 0 493 00000000 .... 0 64313a72 d1:r 493 DNS 69.105.2.89 39.214.90.225 45401 53 17 1168819201.211 178 34 3c2d8000 <-.. 178 3c2d0000 <-.. 34 BitTorrent_UDP 209.33.90.42 69.105.230.150 10430 7226 17 1168819201.416 101 0 64313a61 d1:a 101 00000000 .... 0 ICMP 197.13.74.146 69.105.204.38 0 0 1 1168819201.416 0 33 00000000 .... 0 00000000 .... 0 DNS 69.105.13.4 199.187.132.231 37074 53 17 1168819201.472 0 72 00000000 .... 0 c7370000 .7.. 72 DNS 69.105.13.4 199.187.132.231 39974 53 17 1168819201.472 0 73 00000000 .... 0 ffb50000 .... 73 NTP 61.27.227.243 69.105.2.222 123 123 17 1168819201.492 0 48 00000000 .... 0 0b000000 .... 48 BitTorrent_UDP 212.233.150.39 69.105.230.150 9618 7226 17 1168819201.496 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 44.131.31.16 69.105.207.255 4248 53 17 1168819201.288 450 201 220d8480 "... 106 220d0000 "... 50 Unknown_UDP 138.28.98.240 39.171.180.203 5001 5001 17 1168819201.234 232 976 4116956e A..n 92 b407ec94 .... 884 DNS 69.105.2.89 37.237.13.22 19989 53 17 1168819201.196 258 44 346e8080 4n.. 129 346e0000 4n.. 44 DNS 69.105.13.2 46.152.185.77 25600 53 17 1168819201.515 0 44 00000000 .... 0 08300000 .0.. 44 DNS 69.105.2.232 52.91.49.243 51362 53 17 1168819201.519 234 0 2d068480 -... 234 00000000 .... 0 DNS 69.105.2.89 39.229.159.30 6131 53 17 1168819201.300 286 29 69398000 i9.. 286 69390000 i9.. 29 DNS 69.105.2.232 200.5.74.13 2480 53 17 1168819201.374 191 32 97ac8400 .... 191 97ac0000 .... 32 DNS 69.105.13.2 199.187.132.231 17569 53 17 1168819201.537 0 71 00000000 .... 0 12910000 .... 71 DNS 69.105.13.2 199.187.132.231 19094 53 17 1168819201.539 0 72 00000000 .... 0 5d360000 ]6.. 72 DNS 196.242.143.235 69.105.13.111 35044 53 17 1168819201.551 116 45 39678000 9g.. 116 39670010 9g.. 45 DNS 69.105.2.89 200.215.75.148 42590 53 17 1168819201.559 0 28 00000000 .... 0 fbd10000 .... 28 Skype 69.105.166.211 211.4.229.249 39502 39061 17 1168819201.568 29 0 21e80228 !..( 29 00000000 .... 0 DNS 69.105.2.232 41.200.199.129 20264 53 17 1168819201.108 174 44 9a8c8480 .... 174 9a8c0000 .... 44 DNS 69.105.13.2 53.213.78.29 56772 53 17 1168819201.290 136 34 29868400 )... 136 29860000 )... 34 BitTorrent_UDP 214.87.117.87 69.105.230.150 10044 7226 17 1168819201.583 0 302 00000000 .... 0 64313a72 d1:r 302 DNS 69.105.2.232 214.111.192.254 16321 53 17 1168819201.617 202 0 b61b8400 .... 202 00000000 .... 0 DNS 69.105.13.2 215.224.86.255 12885 53 17 1168819201.620 0 43 00000000 .... 0 00af0000 .... 43 DNS 69.105.2.89 192.138.252.113 3290 53 17 1168819201.623 0 26 00000000 .... 0 14800000 .... 26 DNS 96.179.240.158 69.105.13.111 33918 53 17 1168819201.634 135 52 11c08400 .... 135 11c00010 .... 52 BitTorrent_UDP 58.14.68.107 69.105.230.150 18624 7226 17 1168819201.640 0 302 00000000 .... 0 64313a72 d1:r 302 DNS 69.105.2.89 143.151.170.65 32186 53 17 1168819201.643 113 0 07108483 .... 113 00000000 .... 0 DNS 69.105.2.232 56.200.226.189 19717 53 17 1168819201.520 302 50 98b08400 .... 151 98b00000 .... 50 DNS 40.251.135.82 69.105.2.164 56565 53 17 1168819201.672 180 42 11e58400 .... 180 11e50010 .... 42 DNS 69.105.2.89 98.12.147.237 44226 53 17 1168819201.216 133 34 c4358480 .5.. 133 c4350000 .5.. 34 NTP 142.181.10.234 69.105.2.222 123 123 17 1168819201.681 0 48 00000000 .... 0 db0006ee .... 48 DNS 38.49.19.151 69.105.13.111 32768 53 17 1168819201.681 87 42 664b8400 fK.. 87 664b0010 fK.. 42 NTP 49.169.25.141 69.105.2.222 9718 123 17 1168819201.689 0 48 00000000 .... 0 1b000000 .... 48 BitTorrent_UDP 142.33.181.222 69.105.230.150 23741 7226 17 1168819201.696 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.13.2 199.163.9.10 3390 53 17 1168819201.713 0 44 00000000 .... 0 95ad0000 .... 44 DNS 69.105.13.2 35.63.137.109 61217 53 17 1168819201.522 115 51 872a8403 .*.. 115 872a0000 .*.. 51 DNS 69.105.13.2 200.26.210.91 49822 53 17 1168819201.541 96 44 19a48403 .... 96 19a40000 .... 44 Unknown_UDP 39.171.180.115 38.203.122.246 51667 33490 17 1168819201.727 0 10 00000000 .... 0 00c4aa45 ...E 10 DNS 69.105.13.2 56.237.151.169 51174 53 17 1168819201.527 228 50 25258403 %%.. 114 25250000 %%.. 50 DNS 39.171.180.115 69.202.134.175 15282 53 17 1168819201.016 124 31 0e218400 .!.. 62 0e210000 .!.. 31 DNS 69.105.2.232 48.192.132.38 14556 53 17 1168819201.746 0 45 00000000 .... 0 45460000 EF.. 45 DNS 69.105.13.2 194.236.28.230 6543 53 17 1168819201.534 93 48 aed28403 .... 93 aed20000 .... 48 DNS 69.105.13.2 48.192.132.38 27893 53 17 1168819201.749 0 45 00000000 .... 0 574f0000 WO.. 45 DNS 69.105.13.2 48.192.132.38 60511 53 17 1168819201.749 0 45 00000000 .... 0 5dc50000 ]... 45 DNS 69.105.13.2 48.192.132.38 48014 53 17 1168819201.749 0 45 00000000 .... 0 df8d0000 .... 45 DNS 69.105.2.232 37.173.7.22 31180 53 17 1168819201.761 151 0 4edd8400 N... 151 00000000 .... 0 DNS 69.105.13.2 194.202.187.45 43928 53 17 1168819201.761 226 0 2bb98403 +... 113 00000000 .... 0 DNS 69.105.13.2 48.125.161.47 30984 53 17 1168819201.620 113 49 977e8403 .... 113 977e0000 .... 49 DNS 69.105.2.89 39.222.241.225 24771 53 17 1168819201.564 154 28 55a98000 U... 77 55a90000 U... 28 DNS 69.105.13.2 194.173.240.242 45540 53 17 1168819201.766 325 0 13428480 .B.. 325 00000000 .... 0 DNS 39.171.180.115 36.219.235.44 15282 53 17 1168819201.016 62 27 0e1e8400 .... 62 0e1e0000 .... 27 DNS 69.105.2.232 39.170.246.233 52813 53 17 1168819201.447 122 45 435e8000 C^.. 122 435e0000 C^.. 45 DNS 140.76.12.171 69.105.2.164 33113 53 17 1168819201.806 89 47 3e1c8400 >... 89 3e1c0010 >... 47 Skype 114.46.129.17 69.105.166.211 39779 39502 17 1168819201.819 94 0 37be029c 7... 94 00000000 .... 0 Skype 69.105.166.211 114.44.102.120 39502 34619 17 1168819201.819 0 102 00000000 .... 0 37ba0238 7..8 102 DNS 36.83.204.104 69.105.13.111 38110 53 17 1168819201.824 180 42 16c88400 .... 180 16c80000 .... 42 DNS 196.242.143.235 69.105.207.255 35044 53 17 1168819201.833 153 45 be828480 .... 153 be820010 .... 45 DNS 69.105.2.232 42.45.191.226 25464 53 17 1168819201.847 79 31 d2338000 .3.. 79 d2330000 .3.. 31 DNS 69.105.2.232 43.94.183.9 49550 53 17 1168819201.853 146 31 aa308480 .0.. 146 aa300000 .0.. 31 DNS 69.105.2.89 42.12.224.99 56081 53 17 1168819201.673 90 45 0dae8000 .... 90 0dae0000 .... 45 ICMP 69.105.171.181 197.13.74.146 0 0 1 1168819201.879 33 0 00000000 .... 0 00000000 .... 0 ICMP 69.105.18.240 197.13.74.146 0 0 1 1168819201.881 33 0 00000000 .... 0 00000000 .... 0 ICMP 69.105.228.171 197.13.74.146 0 0 1 1168819201.883 33 0 00000000 .... 0 00000000 .... 0 DNS 69.105.13.2 140.93.155.42 20287 53 17 1168819201.662 325 38 6bfb8480 k... 325 6bfb0000 k... 38 DNS 69.105.13.2 199.163.8.229 7818 53 17 1168819201.885 0 44 00000000 .... 0 5dd30000 ]... 44 ICMP 69.105.15.253 197.13.74.146 0 0 1 1168819201.887 33 0 00000000 .... 0 00000000 .... 0 ICMP 69.105.28.176 197.13.74.146 0 0 1 1168819201.887 33 0 00000000 .... 0 00000000 .... 0 ICMP 197.13.74.146 69.105.48.104 0 0 1 1168819201.896 0 33 00000000 .... 0 00000000 .... 0 BitTorrent_UDP 58.171.134.69 69.105.230.150 27673 7226 17 1168819201.896 101 0 64313a61 d1:a 101 00000000 .... 0 NTP 196.167.167.218 69.105.13.2 123 123 17 1168819201.897 0 48 00000000 .... 0 23000000 #... 48 DNS 69.105.2.225 199.163.9.10 50780 53 17 1168819201.909 0 44 00000000 .... 0 01550000 .U.. 44 DNS 69.105.2.89 34.6.15.82 65043 53 17 1168819201.682 231 34 f8808400 .... 231 f8800000 .... 34 DNS 69.105.13.2 41.61.249.206 26790 53 17 1168819201.923 99 0 10268400 .&.. 99 00000000 .... 0 DNS 69.105.2.89 39.253.2.254 16321 53 17 1168819201.301 180 32 23548000 #T.. 180 23540000 #T.. 32 DNS 69.105.13.2 199.163.9.10 39069 53 17 1168819201.937 0 44 00000000 .... 0 17ec0000 .... 44 NTP 69.105.2.222 61.26.20.210 123 123 17 1168819201.949 48 0 23000000 #... 48 00000000 .... 0 Unknown_UDP 69.105.206.213 48.246.25.166 52883 6277 17 1168819201.210 136 170 00440504 .D.. 68 00aa0502 .... 170 Gnutella_UDP 53.44.136.69 69.105.54.27 57905 27489 17 1168819201.962 0 23 00000000 .... 0 18d9051b .... 23 DNS 39.171.180.245 42.27.219.5 10619 53 17 1168819201.230 190 44 06578180 .W.. 190 06570100 .W.. 44 DNS 69.105.13.2 92.131.66.21 58492 53 17 1168819201.629 236 43 5e6a8480 ^j.. 236 5e6a0000 ^j.. 43 DNS 96.179.240.238 69.105.2.164 35408 53 17 1168819201.994 161 54 32118400 2... 161 32110010 2... 54 BitTorrent_UDP 194.206.30.187 69.105.230.150 60232 7226 17 1168819202.017 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.2.232 41.226.83.26 27218 53 17 1168819201.872 102 46 61ef8000 a... 102 61ef0000 a... 46 DNS 69.105.13.2 56.43.150.236 46708 53 17 1168819201.887 52 26 4a858005 J... 26 4a850000 J... 26 DNS 69.105.2.232 41.200.199.129 36354 53 17 1168819201.569 107 52 2d638483 -c.. 107 2d630000 -c.. 52 DNS 69.105.2.232 49.166.136.217 6804 53 17 1168819202.028 115 0 0a838480 .... 115 00000000 .... 0 No_Payload 42.77.54.77 39.171.180.118 1281 33434 17 1168819202.030 0 0 00000000 .... 0 00000000 .... 0 No_Payload 39.171.180.118 70.8.128.255 1281 33434 17 1168819202.031 0 0 00000000 .... 0 00000000 .... 0 ICMP 39.171.180.118 50.56.179.95 0 0 1 1168819202.027 56 56 00000000 .... 0 00000000 .... 0 DNS 69.105.2.225 198.237.29.82 53737 53 17 1168819201.815 33 33 41918002 A... 33 41910000 A... 33 ICMP 42.18.118.249 39.171.180.118 0 0 1 1168819202.033 56 56 00000000 .... 0 00000000 .... 0 ICMP 39.171.180.118 43.92.248.36 0 0 1 1168819202.039 56 56 00000000 .... 0 00000000 .... 0 NTP 61.26.136.116 69.105.13.2 123 123 17 1168819202.064 0 48 00000000 .... 0 d90004fa .... 48 DNS 69.105.2.89 37.146.33.62 31631 53 17 1168819201.766 145 28 0a2f8000 ./.. 145 0a2f0000 ./.. 28 DNS 69.105.13.2 56.200.226.189 47129 53 17 1168819201.532 188 49 4c6a8403 Lj.. 94 4c6a0000 Lj.. 49 DNS 69.105.2.89 92.131.66.243 39299 53 17 1168819201.742 193 43 332d8400 3-.. 193 332d0000 3-.. 43 DNS 69.105.2.89 215.224.86.255 35626 53 17 1168819202.084 0 68 00000000 .... 0 498f0000 I... 68 SQLExp 69.105.180.89 36.130.83.11 1434 1126 17 1168819202.092 376 0 04010101 .... 376 00000000 .... 0 ICMP 39.171.180.118 42.135.12.22 0 0 1 1168819202.035 56 56 00000000 .... 0 00000000 .... 0 DNS 141.115.134.245 69.105.13.111 54738 53 17 1168819202.095 116 45 52c88000 R... 116 52c80000 R... 45 DNS 69.105.13.2 199.163.9.10 53507 53 17 1168819202.106 0 43 00000000 .... 0 a3a50000 .... 43 DNS 69.105.13.2 199.172.177.142 5348 53 17 1168819201.529 55 55 7b378403 {7.. 55 7b370000 {7.. 55 DNS 69.105.2.232 36.173.228.170 23596 53 17 1168819201.778 166 45 a58b8400 .... 166 a58b0000 .... 45 DNS 69.105.2.232 199.163.8.229 27689 53 17 1168819202.112 0 43 00000000 .... 0 768b0000 v... 43 NTP 58.90.213.30 69.105.2.222 40544 123 17 1168819202.121 0 48 00000000 .... 0 d90004fa .... 48 DNS 69.105.13.2 199.172.177.142 56984 53 17 1168819201.548 58 58 66bc8403 f... 58 66bc0000 f... 58 Unknown_UDP 36.15.98.194 39.171.180.115 64394 33483 17 1168819202.132 0 10 00000000 .... 0 00c4aa45 ...E 10 DNS 69.105.13.2 46.117.186.230 34032 53 17 1168819201.978 137 37 a81d8400 .... 137 a81d0000 .... 37 DNS 69.105.2.89 42.97.4.221 38549 53 17 1168819201.399 113 67 23908483 #... 113 23900000 #... 67 DNS 69.105.2.89 46.152.185.77 62667 53 17 1168819201.967 96 28 1e188000 .... 96 1e180000 .... 28 DNS 69.105.13.2 56.43.134.13 44896 53 17 1168819202.025 52 26 97698005 .i.. 26 97690000 .i.. 26 DNS 39.171.180.115 34.249.199.105 15282 53 17 1168819202.016 900 31 0e228000 .".. 450 0e220000 .".. 31 DNS 69.105.2.89 215.240.255.255 24272 53 17 1168819201.872 168 45 d60b8400 .... 168 d60b0000 .... 45 DNS 69.105.13.4 39.229.159.30 8290 53 17 1168819201.981 108 33 2cda8000 ,... 108 2cda0000 ,... 33 BitTorrent_UDP 194.111.89.194 69.105.230.150 61068 7226 17 1168819202.199 0 302 00000000 .... 0 64313a72 d1:r 302 DNS 69.105.2.89 39.3.15.203 19862 53 17 1168819202.215 192 0 53428000 SB.. 96 00000000 .... 0 DNS 69.105.2.232 143.224.48.226 49182 53 17 1168819201.938 127 44 96288000 .(.. 127 96280000 .(.. 44 DNS 69.105.2.232 41.163.150.15 4122 53 17 1168819202.021 129 46 41098400 A... 129 41090000 A... 46 DNS 69.105.2.232 52.91.49.242 45936 53 17 1168819201.520 370 40 b2588480 .X.. 185 b2580000 .X.. 40 DNS 69.105.2.89 43.65.112.156 6534 53 17 1168819201.931 272 44 68388480 h8.. 272 68380000 h8.. 44 BitTorrent_UDP 143.141.138.234 69.105.230.150 10869 7226 17 1168819202.257 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.2.225 52.94.241.75 9508 53 17 1168819202.259 0 45 00000000 .... 0 35a70000 5... 45 DNS 69.105.2.89 198.237.29.82 64124 53 17 1168819202.039 66 33 0fb48002 .... 33 0fb40000 .... 33 DNS 69.105.2.89 39.212.98.225 28849 53 17 1168819201.202 102 32 4caa8000 L... 102 4caa0000 L... 32 DNS 69.105.2.89 38.131.236.181 41077 53 17 1168819201.524 222 31 e4ce8080 .... 222 e4ce0000 .... 31 DNS 69.105.2.89 39.196.77.1 50810 53 17 1168819201.989 216 32 2a9a8000 *... 108 2a9a0000 *... 32 DNS 69.105.13.2 56.43.150.236 44113 53 17 1168819202.158 52 26 d6dd8005 .... 26 d6dd0000 .... 26 DNS 69.105.2.232 52.34.247.29 15055 53 17 1168819201.067 164 44 6ce38400 l... 164 6ce30000 l... 44 DNS 69.105.2.232 214.111.192.254 6085 53 17 1168819201.618 178 48 3d798400 =y.. 178 3d790000 =y.. 48 DNS 69.105.2.232 168.184.113.201 52161 53 17 1168819201.918 115 35 09ff8480 .... 115 09ff0000 .... 35 DNS 69.105.13.2 192.138.252.112 11573 53 17 1168819202.326 0 26 00000000 .... 0 1e640000 .d.. 26 DNS 39.171.180.115 38.248.140.120 15282 53 17 1168819202.016 64 31 0e238400 .#.. 64 0e230000 .#.. 31 DNS 69.105.2.232 56.200.226.189 30140 53 17 1168819202.186 136 52 a28d8400 .... 68 a28d0000 .... 52 DNS 69.105.2.232 52.34.247.28 56860 53 17 1168819201.108 328 44 d6da8400 .... 164 d6da0000 .... 44 Unknown_UDP 195.27.149.191 69.105.9.210 49532 9680 17 1168819202.340 0 34 00000000 .... 0 80312ba5 .1+. 34 NTP 69.105.2.225 42.27.214.88 123 123 17 1168819202.342 48 0 0b000000 .... 48 00000000 .... 0 DNS 69.105.13.2 48.192.132.38 51742 53 17 1168819202.346 0 45 00000000 .... 0 f0840000 .... 45 DNS 69.105.2.89 32.25.120.245 41101 53 17 1168819201.912 206 43 63cf8400 c... 206 63cf0000 c... 43 DNS 69.105.2.232 199.187.132.231 43920 53 17 1168819202.358 0 74 00000000 .... 0 f67c0000 .|.. 74 DNS 69.105.2.232 199.187.132.231 41724 53 17 1168819202.358 0 74 00000000 .... 0 1bd70000 .... 74 DNS 69.105.2.89 42.42.2.124 50063 53 17 1168819201.981 82 24 90a08400 .... 82 90a00000 .... 24 DNS 69.105.2.225 192.138.252.113 52255 53 17 1168819202.362 0 26 00000000 .... 0 dc090000 .... 26 DNS 69.105.2.225 41.61.249.207 63502 53 17 1168819201.631 99 51 66f88400 f... 99 66f80000 f... 51 ICMP 69.105.32.153 197.13.74.146 0 0 1 1168819202.373 33 0 00000000 .... 0 00000000 .... 0 ICMP 197.13.74.146 69.105.34.31 0 0 1 1168819202.375 0 33 00000000 .... 0 00000000 .... 0 DNS 69.105.2.232 37.173.7.22 27041 53 17 1168819201.164 68 52 214a8400 !J.. 68 214a0000 !J.. 52 ICMP 197.13.74.146 69.105.38.23 0 0 1 1168819202.383 0 33 00000000 .... 0 00000000 .... 0 ICMP 197.13.74.146 69.105.157.32 0 0 1 1168819202.383 0 33 00000000 .... 0 00000000 .... 0 Unknown_UDP 69.105.13.4 39.144.121.21 45888 6277 17 1168819201.955 72 188 00480504 .H.. 72 00bc0502 .... 188 DNS 69.105.13.2 48.192.132.38 6854 53 17 1168819202.385 0 45 00000000 .... 0 6c390000 l9.. 45 ICMP 69.105.180.219 197.13.74.146 0 0 1 1168819202.389 33 0 00000000 .... 0 00000000 .... 0 No_Payload 39.171.180.97 42.67.167.68 1025 33434 17 1168819202.210 0 0 00000000 .... 0 00000000 .... 0 NTP 59.103.204.104 69.105.13.2 10641 123 17 1168819202.403 0 48 00000000 .... 0 13000b00 .... 48 DNS 69.105.2.232 48.246.25.188 54244 53 17 1168819201.355 99 53 8e4e8403 .N.. 99 8e4e0000 .N.. 53 DNS 69.105.2.89 208.29.15.215 34073 53 17 1168819202.068 115 28 3a798400 :y.. 115 3a790000 :y.. 28 DNS 69.105.13.4 198.237.29.136 55359 53 17 1168819202.197 100 33 f4128400 .... 100 f4120000 .... 33 DNS 69.105.2.225 192.138.252.113 45294 53 17 1168819202.422 0 26 00000000 .... 0 6bb40000 k... 26 DNS 69.105.2.89 39.192.15.1 24369 53 17 1168819202.223 102 32 83b18000 .... 102 83b10000 .... 32 DNS 69.105.13.2 48.192.132.38 23159 53 17 1168819202.424 0 45 00000000 .... 0 18940000 .... 45 DNS 69.105.2.232 48.192.132.38 7387 53 17 1168819202.430 0 45 00000000 .... 0 90260000 .&.. 45 DNS 69.105.2.225 192.138.252.113 1686 53 17 1168819202.430 0 26 00000000 .... 0 e6880000 .... 26 DNS 69.105.13.2 56.43.134.13 11850 53 17 1168819202.297 52 26 a2418005 .A.. 26 a2410000 .A.. 26 Unknown_UDP 69.105.2.232 77.229.57.41 48929 6277 17 1168819202.037 208 188 00680604 .h.. 104 00bc0602 .... 188 BitTorrent_UDP 209.196.17.124 69.105.230.150 8369 7226 17 1168819201.456 101 604 64313a61 d1:a 101 64313a72 d1:r 302 DNS 69.105.2.89 41.249.6.18 3240 53 17 1168819202.155 288 40 546e8000 Tn.. 144 546e0000 Tn.. 40 DNS 69.105.2.232 36.173.228.170 21734 53 17 1168819202.112 141 50 ab368400 .6.. 141 ab360000 .6.. 50 Unknown_UDP 39.171.180.115 38.203.122.246 51667 33491 17 1168819202.446 0 10 00000000 .... 0 01c4aa45 ...E 10 BitTorrent_UDP 214.40.8.48 69.105.230.150 20580 7226 17 1168819202.457 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.2.89 75.149.112.234 28740 53 17 1168819202.114 162 36 3d7a8000 =z.. 81 3d7a0000 =z.. 36 BitTorrent_UDP 143.161.231.90 69.105.230.150 16324 7226 17 1168819201.977 101 302 64313a61 d1:a 101 64313a72 d1:r 302 DNS 69.105.2.89 215.240.255.27 55792 53 17 1168819202.172 143 60 55418400 UA.. 143 55410000 UA.. 60 DNS 69.105.2.232 105.157.121.17 14695 53 17 1168819202.219 182 44 99288400 .(.. 182 99280000 .(.. 44 DNS 69.105.13.2 199.187.132.231 54068 53 17 1168819202.485 0 74 00000000 .... 0 8f860000 .... 74 DNS 69.105.13.2 199.187.132.231 36674 53 17 1168819202.485 0 74 00000000 .... 0 4dc70000 M... 74 DNS 69.105.2.232 56.200.226.188 41387 53 17 1168819202.335 306 52 ba2c8400 .,.. 153 ba2c0000 .,.. 52 Unknown_UDP 36.15.98.194 39.171.180.115 64394 33484 17 1168819202.489 0 10 00000000 .... 0 01c4aa45 ...E 10 DNS 69.105.2.89 198.237.29.83 24621 53 17 1168819202.267 66 33 055c8002 .\.. 33 055c0000 .\.. 33 DNS 69.105.2.89 194.236.28.161 36462 53 17 1168819202.286 650 50 d8118400 .... 325 d8110000 .... 50 DNS 69.105.2.232 168.239.255.25 37276 53 17 1168819202.312 179 45 b9d08480 .... 179 b9d00000 .... 45 DNS 69.105.2.89 39.104.140.235 24925 53 17 1168819201.415 430 34 26ba8400 &... 430 26ba0000 &... 34 DNS 69.105.2.89 56.78.177.244 55313 53 17 1168819202.294 309 32 d44d8400 .M.. 309 d44d0000 .M.. 32 NTP 59.102.51.187 69.105.13.2 123 123 17 1168819202.518 0 48 00000000 .... 0 0b000000 .... 48 DNS 69.105.13.2 39.96.255.202 48387 53 17 1168819201.979 113 46 bb148403 .... 113 bb140000 .... 46 ICMP 197.13.74.146 69.105.220.76 0 0 1 1168819202.527 0 33 00000000 .... 0 00000000 .... 0 DNS 141.115.134.245 69.105.207.210 54738 53 17 1168819202.533 153 45 4d488480 MH.. 153 4d480000 MH.. 45 BitTorrent_UDP 62.137.22.217 69.105.230.150 8017 7226 17 1168819202.538 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.13.2 199.187.132.231 43855 53 17 1168819202.538 0 71 00000000 .... 0 f9a70000 .... 71 DNS 69.105.13.2 199.187.132.231 1130 53 17 1168819202.540 0 72 00000000 .... 0 db880000 .... 72 DNS 69.105.2.89 39.196.77.1 10508 53 17 1168819202.238 328 46 b3378000 .7.. 164 b3370000 .7.. 46 DNS 69.105.2.89 98.230.147.5 19820 53 17 1168819202.361 82 24 6f3b8400 o;.. 82 6f3b0000 o;.. 24 DNS 69.105.13.2 199.187.132.231 7744 53 17 1168819202.560 0 74 00000000 .... 0 54610000 Ta.. 74 DNS 69.105.13.2 199.187.132.231 21822 53 17 1168819202.560 0 74 00000000 .... 0 1a3e0000 .>.. 74 DNS 69.105.13.2 56.43.150.236 16664 53 17 1168819202.432 52 26 f7db8005 .... 26 f7db0000 .... 26 DNS 39.171.180.115 35.255.67.22 15282 53 17 1168819202.016 450 31 0e248000 .$.. 450 0e240000 .$.. 31 BitTorrent_UDP 44.102.178.96 69.105.230.150 61845 7226 17 1168819202.578 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.2.89 200.215.75.142 30517 53 17 1168819202.579 0 28 00000000 .... 0 c7e40000 .... 28 DNS 69.105.13.2 49.150.137.11 31392 53 17 1168819202.583 0 49 00000000 .... 0 63ce0000 c... 49 DNS 69.105.2.225 56.43.150.236 46780 53 17 1168819202.461 26 26 d7048005 .... 26 d7040000 .... 26 DNS 69.105.2.89 39.243.34.1 61767 53 17 1168819202.467 111 31 a81d8000 .... 111 a81d0000 .... 31 DNS 69.105.13.2 49.122.20.41 1072 53 17 1168819201.545 98 45 f5a38403 .... 98 f5a30000 .... 45 DNS 69.105.13.2 194.173.115.213 45970 53 17 1168819201.543 97 44 b5418403 .A.. 97 b5410000 .A.. 44 BitTorrent_UDP 208.132.100.55 69.105.230.150 25622 7226 17 1168819201.936 101 2944 64313a61 d1:a 101 64313a72 d1:r 1472 DNS 69.105.2.89 192.138.252.112 62097 53 17 1168819202.625 0 26 00000000 .... 0 d20b0000 .... 26 DNS 69.105.2.89 197.19.137.22 20124 53 17 1168819202.424 69 32 9d9b8480 .... 69 9d9b0000 .... 32 DNS 69.105.2.232 199.187.132.231 24071 53 17 1168819202.634 0 74 00000000 .... 0 978e0000 .... 74 DNS 69.105.2.232 199.187.132.231 15005 53 17 1168819202.634 0 72 00000000 .... 0 04a30000 .... 72 DNS 69.105.13.2 46.117.186.230 35679 53 17 1168819202.485 79 39 09a88400 .... 79 09a80000 .... 39 DNS 69.105.13.2 214.211.218.108 42498 53 17 1168819202.643 0 44 00000000 .... 0 a0350000 .5.. 44 BitTorrent_UDP 204.183.8.17 69.105.230.150 54124 7226 17 1168819202.497 101 716 64313a61 d1:a 101 64313a72 d1:r 358 DNS 69.105.2.225 49.182.103.138 28012 53 17 1168819202.500 68 36 0e188400 .... 68 0e180000 .... 36 DNS 69.105.2.232 37.161.179.160 45562 53 17 1168819202.358 99 53 f14e8403 .N.. 99 f14e0000 .N.. 53 NTP 69.105.2.222 53.89.33.109 123 123 17 1168819202.689 48 0 0b000000 .... 48 00000000 .... 0 DNS 69.105.2.232 168.239.255.25 44460 53 17 1168819202.510 154 57 03d38480 .... 154 03d30000 .... 57 Skype 217.109.219.103 69.105.166.211 18116 15599 17 1168819202.386 23 21 5cc5029b \... 23 d1ad028d .... 21 DNS 69.105.13.2 45.6.215.40 45617 53 17 1168819202.570 96 44 cdf98403 .... 96 cdf90000 .... 44 DNS 69.105.2.89 198.237.29.83 1888 53 17 1168819202.490 66 33 7bf48002 {... 33 7bf40000 {... 33 DNS 69.105.13.2 46.14.237.231 5381 53 17 1168819202.574 98 45 b0448403 .D.. 98 b0440000 .D.. 45 DNS 69.105.2.89 41.63.136.239 12764 53 17 1168819202.381 228 44 b2148000 .... 114 b2140000 .... 44 DNS 69.105.13.2 194.173.240.242 7280 53 17 1168819201.662 325 38 41608480 A`.. 325 41600000 A`.. 38 DNS 69.105.2.89 39.104.141.227 41946 53 17 1168819202.424 860 34 4c488400 LH.. 430 4c480000 LH.. 34 DNS 69.105.2.232 37.173.7.22 53923 53 17 1168819201.533 96 51 605f8403 `_.. 96 605f0000 `_.. 51 DNS 69.105.2.89 194.236.28.213 64626 53 17 1168819202.519 190 50 232f8403 #/.. 95 232f0000 #/.. 50 DNS 69.105.2.232 105.157.121.17 64081 53 17 1168819202.486 156 49 868b8400 .... 156 868b0000 .... 49 DNS 69.105.2.89 208.29.15.215 44219 53 17 1168819202.413 265 28 63c28400 c... 265 63c20000 c... 28 DNS 69.105.13.2 197.131.80.241 22106 53 17 1168819202.579 194 44 92eb8403 .... 97 92eb0000 .... 44 DNS 69.105.2.225 199.163.9.10 54207 53 17 1168819202.773 0 44 00000000 .... 0 0aaa0000 .... 44 DNS 69.105.13.2 56.237.151.171 52678 53 17 1168819202.558 118 54 44b48403 D... 118 44b40000 D... 54 DNS 69.105.2.232 41.95.129.43 33101 53 17 1168819202.335 108 51 b5bc8403 .... 108 b5bc0000 .... 51 DNS 69.105.2.89 41.205.255.178 1992 53 17 1168819202.441 174 40 150c8400 .... 174 150c0000 .... 40 BitTorrent_UDP 139.216.225.144 69.105.230.150 8921 7226 17 1168819202.777 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.13.2 45.32.114.6 21891 53 17 1168819202.560 118 59 82b88403 .... 59 82b80000 .... 59 DNS 69.105.13.2 199.68.228.60 14142 53 17 1168819202.576 58 58 81328403 .2.. 58 81320000 .2.. 58 DNS 69.105.13.2 194.236.28.161 13723 53 17 1168819202.564 194 52 d4568403 .V.. 97 d4560000 .V.. 52 DNS 69.105.2.232 168.135.241.20 11233 53 17 1168819202.595 112 44 b5d28000 .... 112 b5d20000 .... 44 BitTorrent_UDP 214.120.220.196 69.105.230.150 41739 7226 17 1168819201.016 101 566 64313a61 d1:a 101 64313a72 d1:r 566 DNS 69.105.2.232 194.236.28.213 21749 53 17 1168819202.577 192 51 05228403 .".. 96 05220000 .".. 51 SQLExp 69.105.171.39 197.187.152.40 1434 1421 17 1168819202.796 376 0 04010101 .... 376 00000000 .... 0 BitTorrent_UDP 138.118.181.85 69.105.230.150 21074 7226 17 1168819202.817 101 0 64313a61 d1:a 101 00000000 .... 0 Unknown_UDP 39.171.180.115 71.103.247.13 51670 33479 17 1168819202.836 0 10 00000000 .... 0 01c4aa45 ...E 10 Unknown_UDP 36.15.98.194 39.171.180.115 64394 33485 17 1168819202.845 0 10 00000000 .... 0 01c4aa45 ...E 10 DNS 69.105.2.89 194.236.28.161 5479 53 17 1168819202.636 188 49 73c78403 s... 94 73c70000 s... 49 DNS 69.105.13.111 70.121.159.2 53 53 17 1168819202.851 47 130 efb70000 .... 47 efb78400 .... 130 DNS 69.105.2.89 43.65.116.242 50127 53 17 1168819202.551 216 46 f0b98480 .... 216 f0b90000 .... 46 DNS 69.105.2.232 39.253.2.216 45473 53 17 1168819202.232 100 45 a6e08000 .... 100 a6e00000 .... 45 DNS 69.105.2.232 37.173.7.21 46728 53 17 1168819202.551 192 51 47fd8403 G... 96 47fd0000 G... 51 DNS 69.105.13.2 199.187.132.231 21667 53 17 1168819202.872 0 73 00000000 .... 0 8ed20000 .... 73 DNS 69.105.13.2 41.61.249.207 19069 53 17 1168819201.662 99 51 172d8400 .-.. 99 172d0000 .-.. 51 ICMP 69.105.206.251 197.13.74.146 0 0 1 1168819202.883 33 0 00000000 .... 0 00000000 .... 0 DNS 38.49.19.151 69.105.2.164 32768 53 17 1168819202.887 125 42 9add8400 .... 125 9add0010 .... 42 ICMP 197.13.74.146 69.105.157.33 0 0 1 1168819202.890 0 33 00000000 .... 0 00000000 .... 0 ICMP 69.105.143.254 197.13.74.146 0 0 1 1168819202.891 33 0 00000000 .... 0 00000000 .... 0 ICMP 69.105.13.154 197.13.74.146 0 0 1 1168819202.893 33 0 00000000 .... 0 00000000 .... 0 ICMP 197.13.74.146 69.105.13.103 0 0 1 1168819202.898 0 33 00000000 .... 0 00000000 .... 0 ICMP 197.13.74.146 69.105.180.126 0 0 1 1168819202.898 0 33 00000000 .... 0 00000000 .... 0 ICMP 197.13.74.146 69.105.34.32 0 0 1 1168819202.901 0 33 00000000 .... 0 00000000 .... 0 DNS 69.105.2.232 49.140.159.3 27211 53 17 1168819201.864 98 52 ae268403 .&.. 98 ae260000 .&.. 52 DNS 69.105.2.225 35.202.246.124 24817 53 17 1168819202.290 93 44 6a978000 j... 93 6a970000 j... 44 DNS 69.105.13.2 141.144.159.172 48836 53 17 1168819202.573 101 48 22068403 "... 101 22060000 "... 48 DNS 69.105.13.2 198.56.46.126 52855 53 17 1168819202.687 152 41 88998400 .... 76 88990000 .... 41 DNS 69.105.2.225 199.163.9.10 40145 53 17 1168819202.918 0 44 00000000 .... 0 e2d10000 .... 44 DNS 69.105.2.89 38.248.140.18 8884 53 17 1168819202.625 192 39 a2038000 .... 192 a2030000 .... 39 DNS 69.105.13.2 38.248.134.10 35929 53 17 1168819202.628 320 43 9adb8400 .... 160 9adb0000 .... 43 DNS 69.105.13.2 215.181.188.237 43539 53 17 1168819202.530 104 44 4cad8483 L... 104 4cad0000 L... 44 DNS 69.105.2.89 42.42.2.124 21987 53 17 1168819202.552 82 24 66ac8400 f... 82 66ac0000 f... 24 ICMP 39.171.180.97 42.67.167.68 0 0 1 1168819201.431 1011 983 00000000 .... 0 00000000 .... 0 DNS 69.105.2.232 168.141.254.195 10574 53 17 1168819202.792 234 44 437d8400 C}.. 234 437d0000 C}.. 44 DNS 69.105.2.89 35.141.133.255 62784 53 17 1168819202.747 64 48 be958400 .... 64 be950000 .... 48 DNS 69.105.2.89 194.236.28.230 51608 53 17 1168819202.737 650 50 0ea98400 .... 325 0ea90000 .... 50 DNS 49.93.240.2 69.105.2.164 17876 53 17 1168819202.962 115 41 aa218000 .!.. 115 aa210000 .!.. 41 DNS 69.105.13.2 199.187.132.231 50467 53 17 1168819202.966 0 73 00000000 .... 0 fcfc0000 .... 73 DNS 69.105.13.2 158.68.253.170 57327 53 17 1168819202.969 0 46 00000000 .... 0 00510000 .Q.. 46 DNS 69.105.2.89 194.236.28.153 35167 53 17 1168819202.761 648 49 f7968400 .... 324 f7960000 .... 49 DNS 69.105.2.89 32.4.80.7 18893 53 17 1168819201.623 192 39 10328000 .2.. 192 10320000 .2.. 39 DNS 69.105.13.2 199.187.132.231 57858 53 17 1168819202.984 0 74 00000000 .... 0 9a3f0000 .?.. 74 DNS 69.105.13.2 199.187.132.231 26733 53 17 1168819202.984 0 73 00000000 .... 0 ab180000 .... 73 DNS 69.105.2.232 70.252.78.13 17331 53 17 1168819202.795 113 49 2af48403 *... 113 2af40000 *... 49 DNS 69.105.13.2 45.6.215.40 63088 53 17 1168819202.873 95 45 86e68400 .... 95 86e60000 .... 45 BitTorrent_UDP 208.166.79.24 69.105.230.150 8279 7226 17 1168819203.018 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.13.2 46.14.237.231 3770 53 17 1168819202.875 118 46 eb408400 .@.. 118 eb400000 .@.. 46 No_Payload 39.171.180.118 70.200.49.7 1281 33434 17 1168819203.031 0 0 00000000 .... 0 00000000 .... 0 DNS 69.105.2.89 56.200.226.189 21686 53 17 1168819202.499 302 50 131f8400 .... 151 131f0000 .... 50 DNS 69.105.2.232 70.252.78.146 18043 53 17 1168819202.864 98 52 f2818403 .... 98 f2810000 .... 52 DNS 69.105.13.2 70.252.78.13 6669 53 17 1168819202.866 116 52 33e68403 3... 116 33e60000 3... 52 ICMP 197.13.74.146 69.105.141.23 0 0 1 1168819203.056 0 33 00000000 .... 0 00000000 .... 0 DNS 69.105.13.2 216.151.24.178 28503 53 17 1168819202.755 210 49 e4228403 .".. 105 e4220000 .".. 49 DNS 69.105.2.232 70.252.78.13 4207 53 17 1168819202.864 113 49 fbf88403 .... 113 fbf80000 .... 49 DNS 69.105.2.232 49.209.38.38 35222 53 17 1168819202.856 138 39 af9f8000 .... 138 af9f0000 .... 39 DNS 69.105.2.89 75.149.112.234 63837 53 17 1168819202.727 190 44 1eac8000 .... 95 1eac0000 .... 44 DNS 69.105.2.232 197.39.79.227 39134 53 17 1168819202.948 210 58 7c748400 |t.. 210 7c740000 |t.. 58 ICMP 197.13.74.146 69.105.140.42 0 0 1 1168819203.093 0 33 00000000 .... 0 00000000 .... 0 BitTorrent_UDP 58.109.75.133 69.105.230.150 22435 7226 17 1168819203.098 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.2.89 41.205.255.178 43502 53 17 1168819202.779 149 28 89b18400 .... 149 89b10000 .... 28 DNS 69.105.13.2 56.200.226.185 37373 53 17 1168819202.959 116 52 e66d8403 .m.. 116 e66d0000 .m.. 52 BitTorrent_UDP 143.193.86.84 69.105.230.150 25953 7226 17 1168819203.138 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.13.2 199.182.255.16 43060 53 17 1168819202.551 572 46 92568400 .V.. 286 92560000 .V.. 46 DNS 69.105.13.2 35.141.133.255 40267 53 17 1168819202.555 115 51 be978403 .... 115 be970000 .... 51 DNS 69.105.13.2 197.131.80.241 54789 53 17 1168819202.964 202 48 ac7b8403 .{.. 101 ac7b0000 .{.. 48 Unknown_UDP 39.171.180.115 71.103.247.13 51670 33480 17 1168819203.154 0 10 00000000 .... 0 02c4aa45 ...E 10 SNMP 69.105.2.155 69.105.122.249 39405 161 17 1168819203.109 1562 1342 302d0201 0-.. 47 30290201 0).. 43 DNS 69.105.13.2 200.26.210.91 48040 53 17 1168819202.967 97 45 2f1d8403 /... 97 2f1d0000 /... 45 Unknown_UDP 39.171.180.115 38.203.122.246 51667 33492 17 1168819203.157 0 10 00000000 .... 0 02c4aa45 ...E 10 DNS 69.105.13.2 39.192.15.1 30041 53 17 1168819202.964 108 33 c8c88000 .... 108 c8c80000 .... 33 DNS 69.105.13.2 46.117.172.241 55866 53 17 1168819202.637 336 37 d2c68400 .... 336 d2c60000 .... 37 DNS 69.105.13.2 37.173.7.21 11615 53 17 1168819202.870 95 50 3edb8403 >... 95 3edb0000 >... 50 DNS 69.105.2.89 194.236.28.198 29650 53 17 1168819202.957 410 50 a2718400 .q.. 410 a2710000 .q.. 50 DNS 69.105.2.89 39.221.51.1 43397 53 17 1168819203.013 210 33 30e48000 0... 210 30e40000 0... 33 DNS 69.105.13.2 43.196.35.167 54224 53 17 1168819203.180 68 36 90c28400 .... 68 90c20000 .... 36 DNS 39.171.180.91 78.164.74.212 51730 53 17 1168819203.029 291 46 1fbb8400 .... 291 1fbb0010 .... 46 DNS 69.105.13.2 39.253.2.254 25375 53 17 1168819202.964 108 33 5fdf8000 _... 108 5fdf0000 _... 33 DNS 69.105.2.225 199.163.9.10 36209 53 17 1168819203.197 0 43 00000000 .... 0 3ee10000 >... 43 Unknown_UDP 36.15.98.194 39.171.180.115 64394 33486 17 1168819203.201 0 10 00000000 .... 0 02c4aa45 ...E 10 DNS 69.105.2.232 34.63.113.227 6109 53 17 1168819203.063 268 28 f1ad8000 .... 268 f1ad0000 .... 28 DNS 69.105.13.2 158.68.130.247 58004 53 17 1168819202.664 325 38 6d2a8480 m*.. 325 6d2a0000 m*.. 38 DNS 69.105.13.2 198.34.96.209 9594 53 17 1168819202.963 104 60 14098483 .... 104 14090000 .... 60 DNS 69.105.2.89 47.245.7.20 50534 53 17 1168819202.611 145 36 50ec8480 P... 145 50ec0000 P... 36 ICMP 69.105.186.155 197.13.74.146 0 0 1 1168819203.217 33 0 00000000 .... 0 00000000 .... 0 DNS 69.105.13.2 39.216.189.14 23417 53 17 1168819202.518 163 44 f20d8000 .... 163 f20d0000 .... 44 DNS 39.171.180.115 39.229.159.30 15282 53 17 1168819203.016 31 31 0e258004 .%.. 31 0e250000 .%.. 31 BitTorrent_UDP 143.10.61.204 69.105.230.150 8906 7226 17 1168819202.057 101 293 64313a61 d1:a 101 64313a72 d1:r 293 DNS 43.94.102.206 69.105.2.164 34269 53 17 1168819203.240 92 47 2a728400 *r.. 92 2a720000 *r.. 47 DNS 69.105.2.232 70.252.78.146 33525 53 17 1168819203.058 99 53 cb498403 .I.. 99 cb490000 .I.. 53 DNS 69.105.2.225 39.216.189.14 44700 53 17 1168819202.903 99 35 283d8000 (=.. 99 283d0000 (=.. 35 SQLExp 61.207.6.23 69.105.198.85 3011 1434 17 1168819203.254 0 376 00000000 .... 0 04010101 .... 376 DNS 69.105.2.89 213.191.75.3 13253 53 17 1168819202.543 928 45 8e5c8000 .\.. 464 8e5c0000 .\.. 45 DNS 69.105.13.2 216.151.24.178 32255 53 17 1168819202.965 206 47 17988403 .... 103 17980000 .... 47 DNS 69.105.2.89 52.94.241.75 26099 53 17 1168819203.266 0 45 00000000 .... 0 58d20000 X... 45 DNS 69.105.13.2 37.237.13.12 38769 53 17 1168819203.273 0 45 00000000 .... 0 b94e0000 .N.. 45 DNS 69.105.13.2 37.237.13.12 51440 53 17 1168819203.273 0 45 00000000 .... 0 3d4b0000 =K.. 45 DNS 69.105.13.2 37.173.7.21 12526 53 17 1168819202.960 95 50 b3c78403 .... 95 b3c70000 .... 50 DNS 69.105.2.232 92.131.66.243 39288 53 17 1168819203.275 0 43 00000000 .... 0 b2810000 .... 43 DNS 69.105.13.2 195.172.177.163 1697 53 17 1168819202.166 222 42 01508400 .P.. 222 01500000 .P.. 42 DNS 69.105.2.232 52.34.247.28 14698 53 17 1168819202.086 328 44 d8838400 .... 164 d8830000 .... 44 DNS 69.105.2.232 39.199.110.30 35942 53 17 1168819202.593 214 29 cc878000 .... 107 cc870000 .... 29 DNS 69.105.13.2 141.144.159.172 36981 53 17 1168819202.961 118 46 ba968400 .... 118 ba960000 .... 46 DNS 49.93.240.2 69.105.207.255 18102 53 17 1168819203.302 152 41 dd5b8480 .[.. 152 dd5b0000 .[.. 41 DNS 69.105.13.2 168.163.14.222 26180 53 17 1168819203.063 490 42 18c78480 .... 245 18c70000 .... 42 DNS 193.168.138.226 69.105.2.164 4043 53 17 1168819203.311 125 45 6f088100 o... 125 6f080100 o... 45 DNS 69.105.2.89 37.173.7.22 6683 53 17 1168819202.983 150 49 1ec48400 .... 150 1ec40000 .... 49 DNS 69.105.2.89 43.70.228.250 42634 53 17 1168819203.316 0 24 00000000 .... 0 e75b0000 .[.. 24 DNS 69.105.13.2 195.172.178.83 24577 53 17 1168819203.169 240 42 4db48480 M... 240 4db40000 M... 42 DNS 69.105.13.2 199.187.132.231 12620 53 17 1168819203.338 0 72 00000000 .... 0 5ba20000 [... 72 DNS 69.105.13.2 199.187.132.231 16840 53 17 1168819203.338 0 73 00000000 .... 0 f9860000 .... 73 BitTorrent_UDP 141.190.47.10 69.105.230.150 65257 7226 17 1168819203.338 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 39.171.180.115 52.77.121.174 15282 53 17 1168819203.016 62 31 0e268005 .&.. 31 0e260000 .&.. 31 DNS 69.105.2.232 69.38.120.92 36289 53 17 1168819203.049 102 56 bb708403 .p.. 102 bb700000 .p.. 56 DNS 69.105.2.232 197.144.160.235 28093 53 17 1168819203.352 0 45 00000000 .... 0 5da80000 ]... 45 BitTorrent_UDP 53.70.159.83 69.105.230.150 8034 7226 17 1168819203.379 101 0 64313a61 d1:a 101 00000000 .... 0 Unknown_UDP 39.171.180.203 43.216.111.30 5060 5060 17 1168819203.394 4 0 00000000 .... 4 00000000 .... 0 ICMP 69.105.32.218 197.13.74.146 0 0 1 1168819203.394 33 0 00000000 .... 0 00000000 .... 0 DNS 69.105.2.89 39.214.90.225 51849 53 17 1168819203.184 214 44 02c28000 .... 214 02c20000 .... 44 ICMP 197.13.74.146 69.105.171.19 0 0 1 1168819201.072 0 66 00000000 .... 0 00000000 .... 0 ICMP 197.13.74.146 69.105.34.26 0 0 1 1168819201.131 0 66 00000000 .... 0 00000000 .... 0 ICMP 197.13.74.146 69.105.198.62 0 0 1 1168819201.219 0 66 00000000 .... 0 00000000 .... 0 DNS 69.105.13.2 198.237.29.137 9467 53 17 1168819203.171 49 33 71b08400 q... 49 71b00000 q... 33 DNS 69.105.2.232 192.138.252.113 34828 53 17 1168819203.405 0 26 00000000 .... 0 ef2b0000 .+.. 26 DNS 69.105.2.232 45.203.214.90 43047 53 17 1168819203.203 224 28 8bb78000 .... 112 8bb70000 .... 28 ICMP 197.13.74.146 69.105.198.13 0 0 1 1168819201.258 0 66 00000000 .... 0 00000000 .... 0 DNS 69.105.2.89 40.251.135.94 21380 53 17 1168819203.083 352 44 89918480 .... 176 89910000 .... 44 DNS 69.105.2.89 49.140.159.3 29555 53 17 1168819202.847 111 47 be838403 .... 111 be830000 .... 47 DNS 69.105.13.2 198.237.29.136 49536 53 17 1168819203.197 200 33 7ecc8400 .... 100 7ecc0000 .... 33 DNS 69.105.2.89 194.236.28.161 21857 53 17 1168819203.218 650 50 fdc88400 .... 325 fdc80000 .... 50 DNS 69.105.13.2 49.140.159.16 25149 53 17 1168819202.880 93 46 73558403 sU.. 93 73550000 sU.. 46 DNS 69.105.197.19 43.94.184.135 38178 53 17 1168819203.413 116 48 ae5c8010 .\.. 116 ae5c0010 .\.. 48 DNS 69.105.2.89 92.131.66.243 61003 53 17 1168819203.108 170 68 63558400 cU.. 170 63550000 cU.. 68 DNS 69.105.2.89 42.12.225.5 29072 53 17 1168819203.393 99 44 11f88000 .... 99 11f80000 .... 44 DNS 69.105.197.19 50.61.2.25 38178 53 17 1168819203.442 132 48 d72e8480 .... 132 d72e0010 .... 48 DNS 39.171.180.115 41.231.230.178 15282 53 17 1168819203.016 62 31 0e278005 .'.. 31 0e270000 .'.. 31 BitTorrent_UDP 61.5.241.19 69.105.230.150 21240 7226 17 1168819203.458 101 0 64313a61 d1:a 101 00000000 .... 0 BitTorrent_UDP 58.200.170.47 69.105.230.150 12454 7226 17 1168819203.058 101 1472 64313a61 d1:a 101 64313a72 d1:r 1472 Unknown_UDP 39.171.180.115 71.103.247.13 51670 33481 17 1168819203.462 0 10 00000000 .... 0 02c4aa45 ...E 10 DNS 69.105.13.2 199.172.178.197 29352 53 17 1168819202.876 59 59 99558403 .U.. 59 99550000 .U.. 59 NetBIOS_UDP 43.82.22.227 69.105.166.144 137 137 17 1168819201.965 0 100 00000000 .... 0 bcb70000 .... 50 DNS 69.105.2.232 39.192.15.1 47916 53 17 1168819203.285 251 25 350c8000 5... 251 350c0000 5... 25 DNS 193.168.138.226 69.105.144.12 4043 53 17 1168819203.486 158 45 6f088580 o... 158 6f080100 o... 45 NTP 142.181.164.152 69.105.2.222 46699 123 17 1168819203.496 0 48 00000000 .... 0 13000b00 .... 48 DNS 208.63.157.124 69.105.13.111 37669 53 17 1168819203.512 119 36 17bf8400 .... 119 17bf0000 .... 36 ICMP 69.105.167.181 197.13.74.146 0 0 1 1168819203.541 33 0 00000000 .... 0 00000000 .... 0 DNS 69.105.2.232 52.34.247.29 43668 53 17 1168819202.335 140 55 62ed8400 b... 140 62ed0000 b... 55 DNS 69.105.13.2 36.20.106.232 59622 53 17 1168819203.229 282 37 a7368400 .6.. 141 a7360000 .6.. 37 DNS 69.105.13.2 199.187.132.231 16414 53 17 1168819203.545 0 73 00000000 .... 0 861d0000 .... 73 DNS 69.105.13.2 199.187.132.231 28974 53 17 1168819203.545 0 74 00000000 .... 0 1dd70000 .... 74 DNS 69.105.13.2 168.163.5.16 25748 53 17 1168819203.305 658 44 0aa78480 .... 329 0aa70000 .... 44 Skype 69.105.144.86 215.27.55.100 54045 27390 17 1168819202.318 36 32 54e502f0 T... 18 a88a0235 ...5 32 DNS 69.105.2.232 42.12.224.107 18189 53 17 1168819203.355 131 45 9c4e8000 .N.. 131 9c4e0000 .N.. 45 Unknown_UDP 36.15.98.194 39.171.180.115 64394 33487 17 1168819203.559 0 10 00000000 .... 0 02c4aa45 ...E 10 DNS 69.105.13.2 199.187.132.231 9134 53 17 1168819203.562 0 73 00000000 .... 0 dc980000 .... 73 DNS 69.105.13.2 199.187.132.231 20599 53 17 1168819203.562 0 73 00000000 .... 0 85a20000 .... 73 DNS 69.105.13.2 69.104.1.9 63699 53 17 1168819203.562 159 45 04058400 .... 159 04050000 .... 45 DNS 69.105.2.232 37.173.7.1 10750 53 17 1168819203.245 103 57 aabe8403 .... 103 aabe0000 .... 57 DNS 69.105.13.2 39.253.2.216 62197 53 17 1168819203.345 94 45 18708000 .p.. 94 18700000 .p.. 45 DNS 69.105.13.2 45.114.56.37 41812 53 17 1168819203.568 0 45 00000000 .... 0 585e0000 X^.. 45 NTP 61.26.153.95 69.105.13.2 123 123 17 1168819203.571 0 48 00000000 .... 0 23000000 #... 48 DNS 69.105.13.2 41.61.249.207 31389 53 17 1168819202.366 135 51 97938400 .... 135 97930000 .... 51 DNS 69.105.13.2 199.68.228.57 18547 53 17 1168819202.968 59 59 335d8403 3].. 59 335d0000 3].. 59 DNS 69.105.2.89 39.75.246.233 54692 53 17 1168819203.429 306 33 ca1c8000 .... 306 ca1c0000 .... 33 DNS 69.105.2.89 200.215.75.148 39111 53 17 1168819203.579 0 28 00000000 .... 0 77670000 wg.. 28 DNS 69.105.13.2 36.227.22.21 18774 53 17 1168819203.593 0 45 00000000 .... 0 22290000 ").. 45 DNS 69.105.13.2 36.227.22.21 58118 53 17 1168819203.593 0 45 00000000 .... 0 48950000 H... 45 DNS 69.105.13.2 213.94.140.72 63971 53 17 1168819202.878 206 47 aad08403 .... 103 aad00000 .... 47 DNS 69.105.13.2 49.122.20.41 32308 53 17 1168819202.551 97 44 b1568403 .V.. 97 b1560000 .V.. 44 DNS 36.83.190.6 69.105.13.111 54433 53 17 1168819203.602 169 31 0f398400 .9.. 169 0f390000 .9.. 31 DNS 69.105.2.89 44.123.71.109 36016 53 17 1168819203.398 252 33 c7b18400 .... 126 c7b10000 .... 33 DNS 69.105.13.2 194.173.115.213 4165 53 17 1168819202.552 98 45 03978403 .... 98 03970000 .... 45 SQLExp 69.105.171.116 50.25.31.221 1434 1357 17 1168819203.610 376 0 04010101 .... 376 00000000 .... 0 DNS 69.105.2.225 200.215.75.148 60353 53 17 1168819203.621 0 28 00000000 .... 0 8dfa0000 .... 28 NTP 50.6.41.51 69.105.2.222 6126 123 17 1168819203.622 0 48 00000000 .... 0 13000b00 .... 48 Unsupported 69.105.122.244 42.27.214.88 0 0 50 1168819201.017 0 0 00000000 .... 0 00000000 .... 0 DNS 69.105.2.89 200.215.75.148 57059 53 17 1168819203.631 0 28 00000000 .... 0 2ba90000 +... 28 DNS 69.105.2.89 192.138.252.113 43564 53 17 1168819203.631 0 26 00000000 .... 0 27960000 '... 26 DNS 69.105.2.232 101.146.249.245 28092 53 17 1168819203.405 144 28 99278480 .'.. 144 99270000 .'.. 28 DNS 69.105.13.2 45.123.202.172 16471 53 17 1168819203.643 0 44 00000000 .... 0 d91f0000 .... 44 DNS 69.105.2.89 194.236.28.230 39577 53 17 1168819203.440 820 50 e9cf8400 .... 410 e9cf0000 .... 50 NTP 69.105.2.225 142.181.221.118 123 123 17 1168819203.655 48 0 21010aec !... 48 00000000 .... 0 DNS 69.105.2.225 192.138.252.112 10112 53 17 1168819203.657 0 26 00000000 .... 0 91b70000 .... 26 BitTorrent_UDP 58.162.78.198 69.105.230.150 23227 7226 17 1168819203.658 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.13.2 192.138.252.113 45562 53 17 1168819203.665 0 26 00000000 .... 0 bdd80000 .... 26 DNS 69.105.2.89 70.8.138.89 34329 53 17 1168819203.449 634 36 c5e88000 .... 317 c5e80000 .... 36 DNS 69.105.2.225 192.138.252.113 2330 53 17 1168819203.672 0 26 00000000 .... 0 94f70000 .... 26 DNS 69.105.2.89 42.12.224.99 50819 53 17 1168819203.488 106 46 fdf48403 .... 106 fdf40000 .... 46 DNS 69.105.2.232 197.140.25.10 27037 53 17 1168819203.286 139 29 20bb8400 .... 139 20bb0000 .... 29 BitTorrent_UDP 199.93.54.125 69.105.230.150 29542 7226 17 1168819203.418 101 974 64313a61 d1:a 101 64313a72 d1:r 974 BitTorrent_UDP 139.52.139.206 69.105.230.150 24983 7226 17 1168819203.699 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.2.232 49.136.139.22 16316 53 17 1168819203.485 217 25 1cdd8400 .... 217 1cdd0000 .... 25 DNS 69.105.2.89 192.138.252.113 2820 53 17 1168819203.703 0 26 00000000 .... 0 f7250000 .%.. 26 DNS 69.105.2.232 37.173.7.22 20054 53 17 1168819203.703 0 50 00000000 .... 0 a2ec0000 .... 50 DNS 69.105.2.89 39.3.15.203 2066 53 17 1168819203.711 0 43 00000000 .... 0 25120000 %... 43 ICMP 69.105.15.221 197.13.74.146 0 0 1 1168819203.726 33 0 00000000 .... 0 00000000 .... 0 DNS 69.105.2.232 39.157.1.3 16189 53 17 1168819203.439 210 30 64b38000 d... 105 64b30000 d... 30 DNS 69.105.2.232 43.70.240.229 53031 53 17 1168819203.552 121 45 a3008000 .... 121 a3000000 .... 45 DNS 69.105.13.2 52.42.23.13 47952 53 17 1168819203.463 312 32 3f5e8080 ?^.. 156 3f5e0000 ?^.. 32 SQLExp 69.105.231.82 58.21.188.39 1434 1119 17 1168819203.758 376 0 04010101 .... 376 00000000 .... 0 ICMP 197.13.74.146 69.105.38.8 0 0 1 1168819203.759 0 33 00000000 .... 0 00000000 .... 0 DNS 69.105.2.232 38.64.241.255 23436 53 17 1168819203.760 0 51 00000000 .... 0 254b0000 %K.. 51 DNS 69.105.2.232 199.172.179.122 18931 53 17 1168819203.760 0 58 00000000 .... 0 6b0a0000 k... 58 DNS 69.105.2.89 40.251.135.94 1257 53 17 1168819203.421 252 40 18668480 .f.. 126 18660000 .f.. 40 DNS 69.105.2.232 44.231.117.6 54957 53 17 1168819203.763 0 47 00000000 .... 0 45bc0000 E... 47 DNS 69.105.2.89 39.198.236.218 24812 53 17 1168819203.579 137 33 d0d48000 .... 137 d0d40000 .... 33 DNS 69.105.13.2 57.30.125.80 10118 53 17 1168819203.766 0 46 00000000 .... 0 998b0000 .... 46 DNS 69.105.13.2 49.122.20.41 61988 53 17 1168819203.767 0 47 00000000 .... 0 84270000 .'.. 47 DNS 69.105.13.2 44.231.117.6 26860 53 17 1168819203.767 0 45 00000000 .... 0 acb80000 .... 45 DNS 69.105.13.2 199.14.110.41 57195 53 17 1168819203.769 0 53 00000000 .... 0 e5710000 .q.. 53 Unknown_UDP 39.171.180.115 71.103.247.13 51670 33482 17 1168819203.769 0 10 00000000 .... 0 02c4aa45 ...E 10 DNS 69.105.13.2 37.173.7.22 46776 53 17 1168819202.562 94 49 b5c18403 .... 94 b5c10000 .... 49 DNS 69.105.2.232 199.187.132.231 1821 53 17 1168819203.769 0 74 00000000 .... 0 ff530000 .S.. 74 DNS 69.105.13.2 199.187.132.231 3568 53 17 1168819203.769 0 74 00000000 .... 0 39e40000 9... 74 DNS 69.105.13.2 194.248.235.213 27644 53 17 1168819203.770 0 46 00000000 .... 0 2b6a0000 +j.. 46 DNS 69.105.2.232 199.187.132.231 34799 53 17 1168819203.770 0 72 00000000 .... 0 81dd0000 .... 72 DNS 69.105.13.2 199.187.132.231 20551 53 17 1168819203.770 0 72 00000000 .... 0 abbb0000 .... 72 DNS 69.105.13.2 37.173.7.11 21808 53 17 1168819202.581 102 46 ed4b8403 .K.. 102 ed4b0000 .K.. 46 DNS 69.105.13.2 43.94.184.135 61230 53 17 1168819203.767 111 31 95308000 .0.. 111 95300000 .0.. 31 DNS 69.105.13.2 72.163.32.254 35243 53 17 1168819203.772 0 48 00000000 .... 0 acfe0000 .... 48 DNS 69.105.13.2 37.173.7.1 40790 53 17 1168819203.772 0 56 00000000 .... 0 18920000 .... 56 DNS 69.105.2.232 43.94.176.255 58995 53 17 1168819203.766 90 31 d27a8480 .z.. 90 d27a0000 .z.. 31 DNS 69.105.13.2 199.187.132.231 15791 53 17 1168819203.773 0 74 00000000 .... 0 72d70000 r... 74 DNS 69.105.13.2 199.187.132.231 59313 53 17 1168819203.774 0 72 00000000 .... 0 17ee0000 .... 72 DNS 69.105.13.2 42.27.157.222 19821 53 17 1168819203.770 111 31 8e898000 .... 111 8e890000 .... 31 DNS 69.105.13.2 43.94.176.255 48551 53 17 1168819203.771 90 31 55cf8480 U... 90 55cf0000 U... 31 BitTorrent_UDP 62.177.100.147 69.105.230.150 23762 7226 17 1168819203.778 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.13.2 194.236.28.230 31263 53 17 1168819203.562 94 49 53878403 S... 94 53870000 S... 49 DNS 69.105.13.2 43.94.176.255 61892 53 17 1168819203.777 146 31 d8e88480 .... 146 d8e80000 .... 31 DNS 69.105.13.2 42.45.190.154 55171 53 17 1168819203.770 79 31 52c08000 R... 79 52c00000 R... 31 DNS 69.105.13.2 43.94.176.255 30642 53 17 1168819203.785 90 31 5ba98480 [... 90 5ba90000 [... 31 NTP 69.105.2.222 39.68.130.20 123 123 17 1168819202.794 96 0 e30004fa .... 48 00000000 .... 0 DNS 69.105.13.2 44.155.28.119 20703 53 17 1168819203.600 103 37 0d188400 .... 103 0d180000 .... 37 DNS 69.105.2.232 39.221.51.1 5454 53 17 1168819203.631 78 33 57408000 W@.. 78 57400000 W@.. 33 DNS 69.105.2.232 39.226.214.1 2876 53 17 1168819203.588 105 32 ce3f8000 .?.. 105 ce3f0000 .?.. 32 DNS 69.105.2.232 39.213.161.1 56330 53 17 1168819203.482 109 27 01ca8000 .... 109 01ca0000 .... 27 BitTorrent_UDP 209.220.130.16 69.105.230.150 14290 7226 17 1168819203.818 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.2.89 49.151.159.126 59697 53 17 1168819203.606 93 48 d0d18403 .... 93 d0d10000 .... 48 ICMP 39.171.180.118 42.28.149.6 0 0 1 1168819201.939 0 450 00000000 .... 0 00000000 .... 0 ICMP 70.8.128.255 39.171.180.118 0 0 1 1168819201.943 450 0 00000000 .... 0 00000000 .... 0 ICMP 39.171.180.118 70.200.49.7 0 0 1 1168819201.947 0 450 00000000 .... 0 00000000 .... 0 ICMP 50.247.39.134 39.171.180.118 0 0 1 1168819201.955 450 0 00000000 .... 0 00000000 .... 0 DNS 69.105.2.232 106.163.2.242 18618 53 17 1168819203.850 0 39 00000000 .... 0 3f640000 ?d.. 39 DNS 69.105.2.232 35.168.101.20 6953 53 17 1168819203.634 210 39 60218080 `!.. 105 60210000 `!.. 39 ICMP 69.105.231.179 197.13.74.146 0 0 1 1168819203.851 33 0 00000000 .... 0 00000000 .... 0 ICMP 45.35.233.181 39.171.180.118 0 0 1 1168819201.963 450 0 00000000 .... 0 00000000 .... 0 DNS 69.105.13.2 36.20.106.236 58516 53 17 1168819203.545 282 37 26128400 &... 141 26120000 &... 37 ICMP 39.171.180.118 34.181.74.37 0 0 1 1168819201.967 0 450 00000000 .... 0 00000000 .... 0 ICMP 39.8.151.211 39.171.180.118 0 0 1 1168819201.971 450 0 00000000 .... 0 00000000 .... 0 ICMP 70.170.162.205 39.171.180.118 0 0 1 1168819201.975 450 0 00000000 .... 0 00000000 .... 0 ICMP 39.75.42.249 39.171.180.118 0 0 1 1168819201.979 450 0 00000000 .... 0 00000000 .... 0 SQLExp 61.218.233.75 69.105.229.217 4645 1434 17 1168819203.872 0 376 00000000 .... 0 04010101 .... 376 DNS 69.105.13.2 52.78.60.252 41270 53 17 1168819203.562 196 45 33fc8403 3... 98 33fc0000 3... 45 NTP 248.207.216.213 69.105.13.2 32940 123 17 1168819202.876 0 96 00000000 .... 0 e30004fa .... 48 ICMP 39.171.180.118 36.174.250.90 0 0 1 1168819201.983 0 450 00000000 .... 0 00000000 .... 0 DNS 69.105.13.2 199.14.110.37 24850 53 17 1168819203.877 0 54 00000000 .... 0 60600000 ``.. 54 DNS 69.105.13.2 199.187.132.231 57880 53 17 1168819203.877 0 73 00000000 .... 0 744b0000 tK.. 73 ICMP 39.171.180.118 66.116.158.18 0 0 1 1168819201.987 0 450 00000000 .... 0 00000000 .... 0 ICMP 39.171.180.118 38.249.194.30 0 0 1 1168819201.995 0 450 00000000 .... 0 00000000 .... 0 ICMP 69.105.34.169 197.13.74.146 0 0 1 1168819201.483 66 0 00000000 .... 0 00000000 .... 0 DNS 69.105.13.2 41.61.249.206 38551 53 17 1168819202.664 99 51 632e8400 c... 99 632e0000 c... 51 Unknown_UDP 39.171.180.115 38.203.122.246 51667 33493 17 1168819203.893 0 10 00000000 .... 0 02c4aa45 ...E 10 ICMP 83.33.179.208 39.171.180.118 0 0 1 1168819202.003 450 0 00000000 .... 0 00000000 .... 0 DNS 69.105.13.2 141.144.159.172 15937 53 17 1168819203.562 97 44 f67e8403 .... 97 f67e0000 .... 44 ICMP 65.73.252.230 39.171.180.118 0 0 1 1168819202.007 450 0 00000000 .... 0 00000000 .... 0 ICMP 39.171.180.118 70.37.36.69 0 0 1 1168819202.011 0 450 00000000 .... 0 00000000 .... 0 DNS 69.105.2.232 56.200.226.186 10709 53 17 1168819203.759 117 53 2bf18403 +... 117 2bf10000 +... 53 DNS 69.105.2.89 49.39.127.97 65296 53 17 1168819203.703 43 43 3f418082 ?A.. 43 3f410000 ?A.. 43 Unknown_UDP 36.15.98.194 39.171.180.115 64394 33488 17 1168819203.916 0 10 00000000 .... 0 02c4aa45 ...E 10 DNS 69.105.2.232 35.202.246.124 40647 53 17 1168819203.285 92 44 2c408000 ,@.. 92 2c400000 ,@.. 44 DNS 69.105.13.2 46.117.174.61 49723 53 17 1168819203.767 158 31 a3888000 .... 79 a3880000 .... 31 ICMP 69.104.30.161 39.171.180.118 0 0 1 1168819202.043 450 0 00000000 .... 0 00000000 .... 0 DNS 69.105.2.89 39.226.214.1 54093 53 17 1168819203.706 103 28 39018000 9... 103 39010000 9... 28 DNS 69.105.13.2 199.14.110.41 38113 53 17 1168819202.868 95 54 f6988403 .... 95 f6980000 .... 54 ICMP 100.248.143.196 39.171.180.118 0 0 1 1168819202.047 450 0 00000000 .... 0 00000000 .... 0 DNS 69.105.13.2 43.94.176.255 13488 53 17 1168819203.919 146 31 46ff8480 F... 146 46ff0000 F... 31 ICMP 39.171.180.118 42.35.77.9 0 0 1 1168819202.048 0 450 00000000 .... 0 00000000 .... 0 DNS 69.105.2.232 42.45.190.154 11005 53 17 1168819203.918 98 34 a83c8000 .<.. 98 a83c0000 .<.. 34 ICMP 39.171.180.118 42.4.247.45 0 0 1 1168819201.905 503 953 00000000 .... 0 00000000 .... 0 ICMP 39.171.180.118 35.20.159.19 0 0 1 1168819201.915 1262 1262 00000000 .... 0 00000000 .... 0 NTP 43.196.32.233 69.105.2.222 1451 123 17 1168819203.939 0 48 00000000 .... 0 d90004fa .... 48 DNS 69.105.13.2 199.172.179.122 32061 53 17 1168819203.765 58 58 07ff8403 .... 58 07ff0000 .... 58 DNS 69.105.2.232 42.8.207.9 16980 53 17 1168819203.933 98 34 cf928480 .... 98 cf920000 .... 34 DNS 69.105.2.232 34.6.94.44 46797 53 17 1168819203.806 248 27 4bda8400 K... 248 4bda0000 K... 27 DNS 69.105.13.2 194.201.170.126 40327 53 17 1168819203.769 102 58 be2b8403 .+.. 102 be2b0000 .+.. 58 ICMP 69.104.30.163 39.171.180.118 0 0 1 1168819202.055 450 450 00000000 .... 0 00000000 .... 0 DNS 69.105.2.232 56.63.153.165 17478 53 17 1168819203.772 58 58 6ccf8403 l... 58 6ccf0000 l... 58 DNS 69.105.13.2 35.63.137.109 38746 53 17 1168819203.761 117 53 66858403 f... 117 66850000 f... 53 DNS 69.105.13.2 200.26.210.91 18685 53 17 1168819203.771 96 44 25ea8403 %... 96 25ea0000 %... 44 DNS 69.105.13.2 196.229.254.24 33971 53 17 1168819203.766 67 51 4cb48400 L... 67 4cb40000 L... 51 DNS 69.105.2.232 200.26.210.91 41676 53 17 1168819203.771 96 44 5d858403 ]... 96 5d850000 ]... 44 ICMP 50.61.131.221 39.171.180.118 0 0 1 1168819202.055 450 450 00000000 .... 0 00000000 .... 0 DNS 69.105.2.232 43.94.102.206 55844 53 17 1168819203.940 149 44 14e88480 .... 149 14e80000 .... 44 DNS 69.105.2.232 183.245.70.206 27731 53 17 1168819203.763 98 45 981b8403 .... 98 981b0000 .... 45 SQLExp 42.134.229.240 69.105.203.175 2844 1434 17 1168819203.969 0 376 00000000 .... 0 04010101 .... 376 ICMP 39.171.180.118 42.77.54.77 0 0 1 1168819201.730 1396 1424 00000000 .... 0 00000000 .... 0 DNS 69.105.2.89 39.96.255.202 35306 53 17 1168819202.920 502 30 09488000 .H.. 502 09480000 .H.. 30 DNS 69.105.2.232 43.68.142.174 56955 53 17 1168819203.972 0 24 00000000 .... 0 54000000 T... 24 DNS 69.105.2.89 48.125.161.47 36052 53 17 1168819203.823 62 46 95658400 .e.. 62 95650000 .e.. 46 ICMP 69.122.132.129 39.171.180.118 0 0 1 1168819202.059 513 513 00000000 .... 0 00000000 .... 0 DNS 69.105.13.2 46.99.57.193 62455 53 17 1168819203.766 102 58 30588483 0X.. 102 30580000 0X.. 58 DNS 69.105.13.2 199.14.110.39 64527 53 17 1168819203.978 0 54 00000000 .... 0 478e0000 G... 54 DNS 69.105.13.2 199.187.132.231 23651 53 17 1168819203.978 0 73 00000000 .... 0 f7bf0000 .... 73 DNS 69.105.2.225 52.34.247.28 19976 53 17 1168819203.245 99 35 aea18400 .... 99 aea10000 .... 35 DNS 69.105.2.225 52.34.247.28 64181 53 17 1168819203.981 0 44 00000000 .... 0 4c3a0000 L:.. 44 DNS 69.105.2.232 43.68.142.174 50881 53 17 1168819203.983 0 24 00000000 .... 0 5c7a0000 \z.. 24 DNS 69.105.2.89 48.246.25.188 3100 53 17 1168819203.984 0 46 00000000 .... 0 adbf0000 .... 46 DNS 69.105.2.232 194.236.28.177 2372 53 17 1168819203.762 652 51 94fb8400 .... 326 94fb0000 .... 51 DNS 69.105.13.2 45.32.114.6 49896 53 17 1168819203.771 116 58 be708403 .p.. 58 be700000 .p.. 58 DNS 197.168.122.208 69.105.2.164 37974 53 17 1168819203.990 113 55 f9fc8403 .... 113 f9fc0000 .... 55 DNS 69.105.13.2 45.32.114.6 17027 53 17 1168819203.776 116 58 7ad08403 z... 58 7ad00000 z... 58 DNS 69.105.2.232 93.188.130.231 58739 53 17 1168819203.753 320 32 752f8000 u/.. 160 752f0000 u/.. 32 DNS 69.105.2.232 39.192.15.1 54658 53 17 1168819203.806 107 28 5fd48000 _... 107 5fd40000 _... 28 DNS 69.105.2.232 47.178.162.5 25848 53 17 1168819204.003 0 28 00000000 .... 0 b0b40000 .... 28 DNS 69.105.2.232 47.230.29.159 2650 53 17 1168819203.804 284 32 f0988480 .... 142 f0980000 .... 32 DNS 69.105.2.232 198.34.96.209 12646 53 17 1168819203.765 102 58 18fc8483 .... 102 18fc0000 .... 58 DNS 69.105.2.232 37.146.33.62 56267 53 17 1168819203.709 104 32 65338000 e3.. 104 65330000 e3.. 32 DNS 39.171.180.115 38.84.3.47 15282 53 17 1168819204.016 0 27 00000000 .... 0 0e280000 .(.. 27 BitTorrent_UDP 255.120.185.243 69.105.230.150 26119 7226 17 1168819204.019 101 0 64313a61 d1:a 101 00000000 .... 0 No_Payload 39.171.180.118 71.134.47.48 1281 33434 17 1168819204.031 0 0 00000000 .... 0 00000000 .... 0 DNS 69.105.2.89 48.246.25.188 5118 53 17 1168819202.955 110 48 5fca8400 _... 110 5fca0000 _... 48 DNS 69.105.2.232 39.216.189.14 12829 53 17 1168819204.039 0 43 00000000 .... 0 89960000 .... 43 DNS 69.105.2.89 43.70.221.104 37311 53 17 1168819203.670 105 36 56e88080 V... 105 56e80000 V... 36 DNS 69.105.13.2 196.242.64.248 56041 53 17 1168819203.764 117 53 a62c8403 .,.. 117 a62c0000 .,.. 53 DNS 69.105.13.2 199.14.110.37 18640 53 17 1168819202.966 95 54 a48c8403 .... 95 a48c0000 .... 54 DNS 69.105.2.232 208.12.61.154 39219 53 17 1168819203.750 142 30 17a78400 .... 142 17a70000 .... 30 DNS 69.105.2.232 39.199.110.30 41136 53 17 1168819204.053 0 38 00000000 .... 0 96860000 .... 38 DNS 69.105.2.89 74.51.21.26 47450 53 17 1168819203.763 320 33 64498480 dI.. 160 64490000 dI.. 33 NTP 59.103.214.60 69.105.13.2 123 123 17 1168819204.063 0 48 00000000 .... 0 0b000000 .... 48 DNS 69.105.13.2 216.151.24.178 60365 53 17 1168819203.768 868 48 b2328400 .2.. 434 b2320000 .2.. 48 DNS 69.105.2.232 39.70.22.225 31511 53 17 1168819203.842 391 26 fa988400 .... 391 fa980000 .... 26 NTP 43.95.74.138 69.105.2.222 2522 123 17 1168819204.073 0 48 00000000 .... 0 1b000000 .... 48 Unknown_UDP 39.171.180.115 71.103.247.13 51670 33483 17 1168819204.076 0 10 00000000 .... 0 03c4aa45 ...E 10 DNS 69.105.13.2 69.38.120.93 14070 53 17 1168819203.777 102 56 e79d8403 .... 102 e79d0000 .... 56 Unsupported 42.89.79.180 39.171.180.88 0 0 47 1168819201.843 0 0 00000000 .... 0 00000000 .... 0 DNS 69.105.2.232 56.200.226.188 31979 53 17 1168819203.941 194 52 d0338403 .3.. 97 d0330000 .3.. 52 DNS 69.105.2.232 35.141.133.255 56159 53 17 1168819204.093 0 50 00000000 .... 0 c7db0000 .... 50 DNS 69.105.2.232 37.173.7.1 19856 53 17 1168819203.772 102 56 cc5a8403 .Z.. 102 cc5a0000 .Z.. 56 DNS 69.105.13.2 38.90.30.56 13278 53 17 1168819203.775 96 44 27318403 '1.. 96 27310000 '1.. 44 DNS 69.105.2.232 46.117.174.61 3795 53 17 1168819203.960 102 34 19108000 .... 102 19100000 .... 34 ICMP 68.172.64.150 39.171.180.118 0 0 1 1168819201.999 450 450 00000000 .... 0 00000000 .... 0 DNS 69.105.2.232 39.216.189.14 38015 53 17 1168819204.124 0 46 00000000 .... 0 46770000 Fw.. 46 ICMP 39.171.180.118 43.66.125.37 0 0 1 1168819202.063 1207 1207 00000000 .... 0 00000000 .... 0 DNS 69.105.2.89 56.200.226.185 9217 53 17 1168819203.976 110 48 543f8400 T?.. 110 543f0000 T?.. 48 DNS 69.105.2.232 94.144.254.254 4276 53 17 1168819203.805 148 32 d00d8000 .... 74 d00d0000 .... 32 DNS 69.105.2.232 42.53.76.169 37501 53 17 1168819204.109 118 34 ef0c8480 .... 118 ef0c0000 .... 34 DNS 69.105.13.2 197.120.60.123 5699 53 17 1168819203.989 308 46 5dc38400 ]... 308 5dc30000 ]... 46 DNS 69.105.2.89 70.8.138.89 40465 53 17 1168819203.922 1004 30 d7a98000 .... 502 d7a90000 .... 30 ICMP 69.105.55.148 197.13.74.146 0 0 1 1168819204.144 33 0 00000000 .... 0 00000000 .... 0 DNS 69.105.2.89 198.237.29.136 53035 53 17 1168819203.922 95 28 8b138400 .... 95 8b130000 .... 28 ICMP 34.63.254.199 39.171.180.118 0 0 1 1168819202.019 450 450 00000000 .... 0 00000000 .... 0 DNS 69.105.13.2 199.14.61.171 14144 53 17 1168819203.978 93 46 060e8483 .... 93 060e0000 .... 46 DNS 69.105.13.2 38.248.134.10 34580 53 17 1168819203.857 194 44 d0438000 .C.. 97 d0430000 .C.. 44 ICMP 39.146.181.162 39.171.180.118 0 0 1 1168819201.959 450 900 00000000 .... 0 00000000 .... 0 ICMP 39.171.180.118 43.210.38.48 0 0 1 1168819202.015 900 450 00000000 .... 0 00000000 .... 0 DNS 39.171.180.115 39.212.98.225 15282 53 17 1168819204.016 62 31 0e298004 .).. 31 0e290000 .).. 31 ICMP 69.105.128.153 197.13.74.146 0 0 1 1168819204.170 33 0 00000000 .... 0 00000000 .... 0 Unknown_UDP 39.171.180.203 59.103.110.166 5003 5003 17 1168819204.005 688 924 e41583c6 .... 100 397af28e 9z.. 100 DNS 69.105.13.2 47.167.188.29 30347 53 17 1168819203.586 368 42 75568480 uV.. 184 75560000 uV.. 42 DNS 42.27.166.146 69.105.2.164 41158 53 17 1168819204.188 135 52 4d348400 M4.. 135 4d340000 M4.. 52 DNS 69.105.2.232 196.229.254.24 9165 53 17 1168819204.004 96 51 80f18403 .... 96 80f10000 .... 51 DNS 69.105.2.232 142.181.117.209 31499 53 17 1168819204.195 118 29 5a5f8480 Z_.. 118 5a5f0000 Z_.. 29 DNS 69.105.13.2 37.173.7.1 61318 53 17 1168819202.969 104 58 94808403 .... 104 94800000 .... 58 DNS 69.105.2.232 34.70.108.139 26406 53 17 1168819203.998 192 32 b9d08480 .... 192 b9d00000 .... 32 DNS 69.105.2.232 92.131.66.21 64052 53 17 1168819204.218 0 43 00000000 .... 0 efb50000 .... 43 DNS 69.105.2.89 196.229.254.24 31331 53 17 1168819203.117 67 51 dd7d8400 .}.. 67 dd7d0000 .}.. 51 BitTorrent_UDP 63.58.113.25 69.105.230.150 26253 7226 17 1168819204.225 101 0 64313a61 d1:a 101 00000000 .... 0 ICMP 39.171.180.118 69.86.101.60 0 0 1 1168819201.991 450 450 00000000 .... 0 00000000 .... 0 ICMP 69.105.2.171 197.13.74.146 0 0 1 1168819204.236 33 0 00000000 .... 0 00000000 .... 0 DNS 69.105.2.232 72.163.32.228 59416 53 17 1168819203.768 1020 48 cc1a8400 .... 510 cc1a0000 .... 48 NTP 69.105.2.225 59.103.205.218 123 14 17 1168819204.246 48 0 190304fa .... 48 00000000 .... 0 NTP 69.105.2.222 59.103.205.218 123 15 17 1168819204.248 48 0 190304fa .... 48 00000000 .... 0 DNS 69.105.13.2 42.27.166.235 28529 53 17 1168819204.242 94 45 75588480 uX.. 94 75580000 uX.. 45 Unknown_UDP 39.171.180.116 255.243.218.109 5011 5011 17 1168819201.103 828 552 810d6f8c ..o. 60 1ef80239 ...9 60 NTP 69.105.13.2 59.103.205.218 123 16 17 1168819204.251 48 0 190304fa .... 48 00000000 .... 0 Unknown_UDP 39.171.180.116 42.67.167.68 5003 5003 17 1168819203.025 1392 2236 854e7932 .Ny2 164 2c5070fb ,Pp. 164 ICMP 69.105.189.160 197.13.74.146 0 0 1 1168819204.265 33 0 00000000 .... 0 00000000 .... 0 BitTorrent_UDP 69.105.230.150 82.61.195.91 7226 6882 17 1168819204.272 0 101 00000000 .... 0 64313a61 d1:a 101 Unknown_UDP 36.15.98.194 39.171.180.115 64394 33489 17 1168819204.274 0 10 00000000 .... 0 03c4aa45 ...E 10 ICMP 209.165.153.129 69.105.40.14 0 0 1 1168819201.275 0 0 00000000 .... 0 00000000 .... 0 DNS 69.105.13.2 69.38.120.93 59775 53 17 1168819203.978 104 58 9a938403 .... 104 9a930000 .... 58 DNS 69.105.2.89 52.94.241.75 37835 53 17 1168819204.283 0 45 00000000 .... 0 9cde0000 .... 45 DNS 69.105.2.89 39.199.110.30 57271 53 17 1168819203.588 118 33 6b778000 kw.. 118 6b770000 kw.. 33 DNS 69.105.2.232 39.221.51.47 15778 53 17 1168819204.132 105 46 35cb8000 5... 105 35cb0000 5... 46 DNS 69.105.2.232 215.224.86.255 21624 53 17 1168819204.288 0 43 00000000 .... 0 810a0000 .... 43 DNS 69.105.2.89 39.229.159.43 34921 53 17 1168819204.076 365 32 f54d8400 .M.. 365 f54d0000 .M.. 32 DNS 69.105.13.2 56.200.226.188 40990 53 17 1168819203.763 134 51 825f8400 ._.. 67 825f0000 ._.. 51 DNS 69.105.13.2 199.185.182.10 40428 53 17 1168819203.764 100 47 6cc48403 l... 100 6cc40000 l... 47 DNS 69.105.13.2 199.185.182.10 50240 53 17 1168819203.764 98 45 de048403 .... 98 de040000 .... 45 BitTorrent_UDP 196.51.32.102 69.105.230.150 62928 7226 17 1168819204.311 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 89.50.133.251 69.105.13.111 49647 53 17 1168819201.200 2176 488 35e28000 5... 272 35e20000 5... 61 DNS 69.105.2.89 43.70.224.248 62038 53 17 1168819204.335 0 24 00000000 .... 0 adb00000 .... 24 DNS 69.105.2.232 49.223.114.21 28294 53 17 1168819204.200 65 49 07718400 .q.. 65 07710000 .q.. 49 DNS 39.171.180.245 42.27.219.5 10621 53 17 1168819204.339 0 44 00000000 .... 0 06690100 .i.. 44 DNS 69.105.2.89 74.51.21.37 26180 53 17 1168819204.059 380 30 d8d68080 .... 190 d8d60000 .... 30 DNS 69.105.13.2 46.4.178.139 51813 53 17 1168819204.135 52 36 d46c8400 .l.. 52 d46c0000 .l.. 36 DNS 69.105.2.89 37.161.179.160 57858 53 17 1168819204.344 0 53 00000000 .... 0 0f110000 .... 53 DNS 69.105.2.232 52.34.247.29 37292 53 17 1168819203.088 164 44 2cc08400 ,... 164 2cc00000 ,... 44 DNS 69.105.2.232 217.195.139.83 18466 53 17 1168819204.011 180 32 d6d18480 .... 180 d6d10000 .... 32 DNS 69.105.2.89 194.236.28.153 41954 53 17 1168819204.130 652 51 51858400 Q... 326 51850000 Q... 51 BitTorrent_UDP 141.215.178.84 69.105.230.150 16224 7226 17 1168819204.352 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.13.2 199.68.228.59 36794 53 17 1168819203.763 58 58 1fbb8403 .... 58 1fbb0000 .... 58 DNS 69.105.2.232 56.200.226.189 6303 53 17 1168819204.201 190 50 1a188403 .... 95 1a180000 .... 50 DNS 69.105.2.89 39.226.214.1 32825 53 17 1168819204.144 132 30 4fc18000 O... 132 4fc10000 O... 30 DNS 69.105.2.232 52.34.247.29 32132 53 17 1168819204.355 0 55 00000000 .... 0 dd3c0000 .<.. 55 DNS 69.105.2.89 90.135.135.255 7900 53 17 1168819204.356 0 39 00000000 .... 0 d8810000 .... 39 DNS 69.105.2.89 49.151.159.126 40270 53 17 1168819204.147 326 51 ea208400 .... 326 ea200000 .... 51 ICMP 197.13.74.146 69.105.200.88 0 0 1 1168819204.364 0 33 00000000 .... 0 00000000 .... 0 DNS 69.105.2.89 56.200.226.188 44061 53 17 1168819204.365 0 51 00000000 .... 0 6cbc0000 l... 51 DNS 69.105.2.232 194.248.235.213 61484 53 17 1168819203.765 99 46 8df38403 .... 99 8df30000 .... 46 DNS 69.105.2.225 41.61.249.206 27369 53 17 1168819204.367 0 51 00000000 .... 0 61fc0000 a... 51 ICMP 39.171.180.118 71.134.47.48 0 0 1 1168819201.951 478 450 00000000 .... 0 00000000 .... 0 Unsupported 69.105.122.244 50.61.10.143 0 0 50 1168819201.770 0 0 00000000 .... 0 00000000 .... 0 DNS 69.105.13.4 39.253.2.254 20464 53 17 1168819204.376 0 25 00000000 .... 0 0bf00000 .... 25 DNS 69.105.2.232 37.173.7.21 24930 53 17 1168819204.072 94 49 6fd18403 o... 94 6fd10000 o... 49 NTP 69.105.2.221 94.207.91.13 123 123 17 1168819204.382 0 48 00000000 .... 0 1a0104f8 .... 48 DNS 69.105.13.2 41.61.249.206 63758 53 17 1168819204.382 0 51 00000000 .... 0 d7de0000 .... 51 ICMP 69.105.25.231 197.13.74.146 0 0 1 1168819202.062 66 0 00000000 .... 0 00000000 .... 0 Unknown_UDP 39.171.180.115 71.103.247.13 51670 33484 17 1168819204.387 0 10 00000000 .... 0 03c4aa45 ...E 10 ICMP 39.98.17.236 39.171.180.118 0 0 1 1168819202.023 450 450 00000000 .... 0 00000000 .... 0 DNS 69.105.2.232 39.253.0.8 48205 53 17 1168819204.382 350 36 67638000 gc.. 350 67630000 gc.. 36 DNS 69.105.13.2 48.85.122.73 47253 53 17 1168819203.772 53 53 5a348403 Z4.. 53 5a340000 Z4.. 53 DNS 69.105.2.89 39.192.15.1 31906 53 17 1168819204.194 109 28 ab068000 .... 109 ab060000 .... 28 ICMP 197.13.74.146 69.105.222.53 0 0 1 1168819204.403 0 33 00000000 .... 0 00000000 .... 0 DNS 69.105.2.232 51.249.125.214 13883 53 17 1168819204.218 232 45 9f718480 .q.. 232 9f710000 .q.. 45 Unknown_UDP 50.60.128.157 69.105.54.43 1469 8767 17 1168819201.231 1706 80 f4be0200 .... 24 f4be0100 .... 20 DNS 69.105.2.89 43.195.240.1 19458 53 17 1168819204.051 105 36 33758400 3u.. 105 33750000 3u.. 36 DNS 69.105.2.89 43.195.247.247 53416 53 17 1168819204.422 0 44 00000000 .... 0 6ce50000 l... 44 DNS 69.105.2.232 34.63.113.227 8587 53 17 1168819204.288 509 40 abaa8000 .... 509 abaa0000 .... 40 DNS 69.105.2.232 39.226.214.1 28768 53 17 1168819204.429 0 40 00000000 .... 0 c5a30000 .... 40 DNS 69.105.2.89 56.93.10.242 21970 53 17 1168819204.286 89 33 cc168400 .... 89 cc160000 .... 33 DNS 69.105.2.89 194.236.28.198 36984 53 17 1168819204.437 0 51 00000000 .... 0 9afd0000 .... 51 DNS 208.63.157.124 69.105.2.164 37669 53 17 1168819204.440 119 36 01628400 .b.. 119 01620000 .b.. 36 DNS 69.105.13.2 199.187.132.231 3841 53 17 1168819204.443 0 74 00000000 .... 0 38df0000 8... 74 DNS 69.105.13.2 199.187.132.231 28083 53 17 1168819204.443 0 74 00000000 .... 0 336b0000 3k.. 74 Unknown_UDP 69.105.13.2 50.105.96.19 524 12452 17 1168819202.575 14 0 111100ff .... 7 00000000 .... 0 DNS 69.105.13.2 72.163.32.228 44986 53 17 1168819203.586 204 46 60528403 `R.. 102 60520000 `R.. 46 DNS 69.105.2.89 39.212.98.213 16456 53 17 1168819204.297 101 43 4c848000 L... 101 4c840000 L... 43 DNS 69.105.2.89 199.212.120.70 41839 53 17 1168819204.449 0 43 00000000 .... 0 d43c0000 .<.. 43 DNS 69.105.2.232 141.27.186.251 34757 53 17 1168819204.458 0 56 00000000 .... 0 f6c40000 .... 56 DNS 69.105.2.232 39.178.133.230 64663 53 17 1168819204.094 398 45 2c268480 ,&.. 199 2c260000 ,&.. 45 SQLExp 59.244.255.227 69.105.157.41 4686 1434 17 1168819204.464 0 376 00000000 .... 0 04010101 .... 376 DNS 69.105.13.2 37.237.12.249 13386 53 17 1168819204.149 129 44 fb9a8080 .... 129 fb9a0000 .... 44 DNS 69.105.13.2 37.237.13.22 1392 53 17 1168819204.465 0 44 00000000 .... 0 912b0000 .+.. 44 DNS 69.105.2.232 53.230.172.46 50205 53 17 1168819204.130 128 32 5e698400 ^i.. 64 5e690000 ^i.. 32 DNS 69.105.2.232 49.151.159.126 6931 53 17 1168819204.468 0 51 00000000 .... 0 37f00000 7... 51 DNS 69.105.2.232 39.196.77.1 44141 53 17 1168819204.478 0 32 00000000 .... 0 cb190000 .... 32 DNS 69.105.13.2 56.200.226.186 26615 53 17 1168819204.487 0 52 00000000 .... 0 a0190000 .... 52 DNS 69.105.13.2 56.237.151.171 22923 53 17 1168819204.488 0 51 00000000 .... 0 45ec0000 E... 51 NTP 50.60.218.205 69.105.2.222 32769 123 17 1168819204.489 0 48 00000000 .... 0 0b000000 .... 48 DNS 69.105.13.2 199.68.228.63 24994 53 17 1168819204.489 0 57 00000000 .... 0 c2950000 .... 57 DNS 69.105.13.2 194.236.28.153 63227 53 17 1168819204.490 0 49 00000000 .... 0 59c80000 Y... 49 DNS 69.105.13.2 194.236.28.230 46210 53 17 1168819204.491 0 50 00000000 .... 0 fddd0000 .... 50 DNS 69.105.13.2 44.231.117.6 32906 53 17 1168819204.494 0 46 00000000 .... 0 02bd0000 .... 46 DNS 69.105.13.2 52.78.60.252 17626 53 17 1168819204.494 0 45 00000000 .... 0 c98f0000 .... 45 DNS 69.105.13.2 49.241.133.246 5518 53 17 1168819204.500 0 46 00000000 .... 0 16140000 .... 46 DNS 69.105.2.89 70.35.10.51 45567 53 17 1168819204.283 195 44 7e908000 .... 195 7e900000 .... 44 DNS 69.105.13.2 199.14.110.41 62388 53 17 1168819204.502 0 53 00000000 .... 0 80d80000 .... 53 DNS 69.105.2.89 39.229.159.43 7055 53 17 1168819204.503 0 44 00000000 .... 0 2d890000 -... 44 DNS 69.105.13.2 199.187.132.231 50194 53 17 1168819204.503 0 73 00000000 .... 0 fec20000 .... 73 DNS 69.105.13.2 199.187.132.231 22043 53 17 1168819204.504 0 72 00000000 .... 0 f4e90000 .... 72 DNS 69.105.13.2 56.200.226.191 26332 53 17 1168819204.505 0 44 00000000 .... 0 93580000 .X.. 44 DNS 69.105.13.2 199.172.178.197 42747 53 17 1168819204.506 0 58 00000000 .... 0 e0690000 .i.. 58 DNS 69.105.13.2 48.246.25.161 43134 53 17 1168819204.508 0 45 00000000 .... 0 11060000 .... 45 DNS 141.72.168.228 69.105.13.111 56245 53 17 1168819204.509 118 35 94728400 .r.. 118 94720000 .r.. 35 DNS 69.105.2.225 36.20.106.236 62837 53 17 1168819204.511 0 37 00000000 .... 0 c7e40000 .... 37 DNS 69.105.2.232 36.83.204.65 61236 53 17 1168819204.222 120 45 cad88403 .... 120 cad80000 .... 45 NTP 69.105.2.222 43.231.43.74 123 123 17 1168819204.522 48 0 db0006ee .... 48 00000000 .... 0 DNS 34.195.225.230 69.105.2.164 52202 53 17 1168819204.521 100 45 a9628000 .b.. 100 a9620000 .b.. 45 DNS 69.105.13.2 42.12.227.140 30672 53 17 1168819204.265 91 44 1b9f8000 .... 91 1b9f0000 .... 44 DNS 69.105.13.2 50.56.190.237 45172 53 17 1168819204.523 99 44 a0088483 .... 99 a0080000 .... 44 DNS 69.105.2.232 34.249.199.23 63107 53 17 1168819204.390 398 36 29238000 )#.. 199 29230000 )#.. 36 DNS 69.105.2.232 39.96.228.244 11991 53 17 1168819204.537 0 36 00000000 .... 0 2c8b0000 ,... 36 BitTorrent_UDP 59.105.184.232 69.105.230.150 17160 7226 17 1168819203.738 101 604 64313a61 d1:a 101 64313a72 d1:r 302 DNS 69.105.2.232 39.202.120.30 3240 53 17 1168819204.338 350 36 e3bb8000 .... 350 e3bb0000 .... 36 DNS 69.105.2.232 46.117.174.226 42754 53 17 1168819204.546 0 36 00000000 .... 0 e6b30000 .... 36 DNS 69.105.2.89 39.199.110.30 32795 53 17 1168819203.853 186 25 bfb98000 .... 186 bfb90000 .... 25 DNS 69.105.2.89 166.114.113.196 43968 53 17 1168819204.548 0 25 00000000 .... 0 d6c40000 .... 25 BitTorrent_UDP 196.156.227.33 69.105.230.150 61321 7226 17 1168819204.552 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 95.47.46.213 69.105.2.164 53 53 17 1168819204.553 180 42 92d08400 .... 180 92d00000 .... 42 DNS 69.105.2.232 39.202.120.30 40873 53 17 1168819204.356 350 36 ae578000 .W.. 350 ae570000 .W.. 36 DNS 69.105.2.232 35.255.67.22 53950 53 17 1168819204.564 0 36 00000000 .... 0 03880000 .... 36 DNS 69.105.13.2 39.216.189.14 57576 53 17 1168819204.566 0 44 00000000 .... 0 2ebb0000 .... 44 DNS 69.105.2.89 194.236.28.150 60618 53 17 1168819204.352 822 51 bbb58400 .... 411 bbb50000 .... 51 DNS 69.105.13.2 56.55.195.171 16290 53 17 1168819204.382 103 37 53c88400 S... 103 53c80000 S... 37 DNS 69.105.13.2 45.114.4.249 4886 53 17 1168819204.577 0 45 00000000 .... 0 9ad20000 .... 45 DNS 46.71.24.211 69.105.13.111 32768 53 17 1168819204.582 311 42 45548400 ET.. 311 45540010 ET.. 42 DNS 69.105.13.4 39.199.110.30 22946 53 17 1168819203.353 352 25 fa3d8000 .=.. 176 fa3d0000 .=.. 25 DNS 69.105.2.232 52.34.247.28 38769 53 17 1168819203.352 280 55 fc3b8400 .;.. 140 fc3b0000 .;.. 55 BitTorrent_UDP 63.82.215.21 69.105.230.150 16351 7226 17 1168819204.592 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.2.89 200.41.220.69 47861 53 17 1168819204.398 148 28 ac078400 .... 148 ac070000 .... 28 DNS 69.105.2.232 51.249.125.214 12952 53 17 1168819204.415 207 43 fd758480 .u.. 207 fd750000 .u.. 43 DNS 69.105.2.225 36.227.22.21 55310 53 17 1168819204.611 0 45 00000000 .... 0 0c5f0000 ._.. 45 DNS 69.105.2.225 36.227.22.21 29024 53 17 1168819204.611 0 45 00000000 .... 0 72c90000 r... 45 DNS 69.105.13.2 143.247.81.117 56535 53 17 1168819204.344 52 36 44898400 D... 52 44890000 D... 36 DNS 69.105.13.2 46.4.178.139 8949 53 17 1168819204.614 0 36 00000000 .... 0 12d00000 .... 36 Unknown_UDP 50.60.128.157 69.105.54.43 1470 27960 17 1168819201.009 22147 4386 b3100100 .... 238 04670100 .g.. 39 DNS 69.105.13.2 41.61.249.206 53679 53 17 1168819203.382 135 51 9a9d8400 .... 135 9a9d0000 .... 51 Unknown_UDP 36.15.98.194 39.171.180.115 64394 33490 17 1168819204.631 0 10 00000000 .... 0 03c4aa45 ...E 10 Unknown_UDP 39.171.180.115 38.203.122.246 51667 33494 17 1168819204.631 0 10 00000000 .... 0 03c4aa45 ...E 10 BitTorrent_UDP 32.219.96.223 69.105.230.150 10292 7226 17 1168819204.632 101 0 64313a61 d1:a 101 00000000 .... 0 DNS 69.105.2.232 56.131.129.6 46382 53 17 1168819203.801 483 33 b2cc8480 .... 483 b2cc0000 .... 33 Unknown_UDP 43.94.240.242 69.105.54.43 27960 27960 17 1168819201.004 9404 6027 d4b10000 .... 154 c4940100 .... 45 DNS 69.105.2.232 194.236.28.153 24685 53 17 1168819204.634 0 50 00000000 .... 0 1a4e0000 .N.. 50 DNS 69.105.2.232 48.246.25.188 10039 53 17 1168819204.636 0 47 00000000 .... 0 f3af0000 .... 47 DNS 69.105.2.232 36.242.58.241 36767 53 17 1168819204.637 0 47 00000000 .... 0 4dd90000 M... 47 DNS 69.105.2.232 35.255.67.22 33139 53 17 1168819204.637 0 31 00000000 .... 0 641d0000 d... 31 DNS 69.105.2.232 52.2.27.5 36581 53 17 1168819204.638 0 50 00000000 .... 0 b62f0000 ./.. 50 RTP 138.28.239.9 39.171.180.203 35440 35410 17 1168819201.010 5760 5824 80121afc .... 32 8012a8b2 .... 32 DNS 69.105.2.232 198.117.167.61 34504 53 17 1168819204.639 0 44 00000000 .... 0 0c9f0000 .... 44 DNS 89.50.133.3 69.105.13.111 1828 53 17 1168819201.514 1088 244 73e08000 s... 272 73e00000 s... 61 DNS 69.105.2.232 194.201.170.126 46452 53 17 1168819204.641 0 57 00000000 .... 0 c1b70000 .... 57 DNS 69.105.2.232 49.42.116.243 53234 53 17 1168819204.642 0 45 00000000 .... 0 f0d10000 .... 45 DNS 69.105.2.232 195.59.19.103 54268 53 17 1168819204.642 0 30 00000000 .... 0 e8ad0000 .... 30 DNS 69.105.2.232 70.254.249.249 44558 53 17 1168819204.643 0 45 00000000 .... 0 300a0000 0... 45 DNS 69.105.2.89 39.221.51.1 22724 53 17 1168819204.478 109 31 aef48000 .... 109 aef40000 .... 31 DNS 69.105.2.89 194.201.238.41 26632 53 17 1168819204.644 0 31 00000000 .... 0 04760000 .v.. 31 DNS 69.105.2.232 48.85.122.73 36486 53 17 1168819204.644 0 52 00000000 .... 0 2e640000 .d.. 52 DNS 69.105.2.232 199.187.132.231 17265 53 17 1168819204.644 0 71 00000000 .... 0 62b60000 b... 71 DNS 69.105.2.232 200.26.210.91 6296 53 17 1168819204.645 0 43 00000000 .... 0 44ce0000 D... 43 DNS 69.105.2.232 199.68.228.60 36061 53 17 1168819204.646 0 57 00000000 .... 0 757c0000 u|.. 57 DNS 69.105.2.232 37.173.7.1 16144 53 17 1168819204.646 0 55 00000000 .... 0 3c910000 <... 55 ================================================ FILE: tools/Makefile.am ================================================ SUBDIRS=find_unknown protoident arff #SUBDIRS += live EXTRA_DIST=tools_common.h ================================================ FILE: tools/Makefile.tools ================================================ AM_CFLAGS=-I"$(top_srcdir)/lib" AM_CXXFLAGS=-I"$(top_srcdir)/lib" AM_LDFLAGS=-L"$(top_srcdir)/lib/.libs" ================================================ FILE: tools/arff/Makefile.am ================================================ bin_PROGRAMS=lpi_arff man_MANS = lpi_arff.1 EXTRA_DIST = $(man_MANS) include ../Makefile.tools lpi_arff_SOURCES=lpi_arff.cc ../tools_common.cc lpi_arff_LDADD = @ADD_LIBS@ -lprotoident ================================================ FILE: tools/arff/lpi_arff.1 ================================================ .TH LPI_ARFF "1" "April 2019" "libprotoident" "User Commands" .SH NAME lpi_arff \- output the application protocol of all network flows in a trace using the ARFF format .SH SYNOPSIS .B lpi_arff inputuri .SH DESCRIPTION This tool attempts to identify each individual flow within the provided network packet trace, using libprotoident to attempt to determine the application protocol being used by each flow. The output of this tool is written to standard output using the ARFF format so that it can be analysed easily using the Weka machine learning software. Note that identification only occurs when the flow has concluded or expired due to inactivity, so it is not very effective for real-time use cases. .PP The \fBinputuri\fR argument must be a valid libtrace URI. .SH OUTPUT FORMAT The output begins with a series of lines describing each feature that will be used to describe each flow. Following that, for each flow in the input trace, a single line is printed to stdout describing the flow. The line contains the following comma-separated fields (in order): .nf * Application protocol (as reported by libprotoident) * ID number for the application protocol * Total number of packets sent from first endpoint to second endpoint * Total number of bytes sent from first endpoint to second endpoint * Total number of packets sent from second endpoint to first endpoint * Total number of bytes sent from second endpoint to first endpoint * Minimum payload size sent from first endpoint to second endpoint * Mean payload size sent from first endpoint to second endpoint * Maximum payload size sent from first endpoint to second endpoint * Standard deviation of payload size sent from first endpoint to second endpoint * Minimum payload size sent from second endpoint to first endpoint * Mean payload size sent from second endpoint to first endpoint * Maximum payload size sent from second endpoint to first endpoint * Standard deviation of payload size sent from second endpoint to first endpoint * Minimum packet interarrival time for packets sent from first endpoint to second endpoint * Mean packet interarrival time for packets sent from first endpoint to second endpoint * Maximum packet interarrival time for packets sent from first endpoint to second endpoint * Standard deviation of packet interarrival time for packets sent from first endpoint to second endpoint * Minimum packet interarrival time for packets sent from second endpoint to first endpoint * Mean packet interarrival time for packets sent from second endpoint to first endpoint * Maximum packet interarrival time for packets sent from second endpoint to first endpoint * Standard deviation of packet interarrival time for packets sent from second endpoint to first endpoint * Flow duration (in microseconds) * Flow start time (as a Unix timestamp) .fi .SH LINKS More details about libprotoident, the protocols it supports and how it works can be found at https://github.com/wanduow/libprotoident/wiki .SH SEE ALSO lpi_find_unknown(1), lpi_protoident(1) .SH AUTHORS Shane Alcock ================================================ FILE: tools/arff/lpi_arff.cc ================================================ /* * This file is part of libprotoident * * Copyright (c) 2011-2015 The University of Waikato, Hamilton, New Zealand. * Author: Shane Alcock * * With contributions from: * Aaron Murrihy * Donald Neal * Paweł Foremski (ARFF statistics) * * All rights reserved. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with libprotoident; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: lpi_protoident.cc 102 2011-10-18 00:43:04Z salcock $ */ /* * Program flow * * main() * - parse command-line options * - initialize libraries * - read packet by packet in loop, call per_packet() for each * per_packet() * - skip non-IP traffic * - call garbage collector - expire_ident_flows() - may print output * - match packet to flow * - update flow statistics * - identify the packet, call libprotoident * * expire_ident_flows() * - loop through all expired flows and call display_ident() for each of them * */ #define __STDC_FORMAT_MACROS #define __STDC_LIMIT_MACROS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../tools_common.h" enum { DIR_METHOD_TRACE, DIR_METHOD_MAC, DIR_METHOD_PORT }; libtrace_t *currenttrace; static volatile int done = 0; struct globalopts { int dir_method; bool only_dir0 ; bool only_dir1 ; bool require_both ; bool nat_hole ; bool ignore_rfc1918 ; char *local_mac ; uint8_t mac_bytes[6]; }; struct threadlocal { FlowManager *flowmanager; }; struct ident_stats { uint64_t pkts; uint64_t bytes; uint16_t pktlen_min; uint16_t pktlen_max; double pktlen_mean; double pktlen_std; uint32_t iat_min; uint32_t iat_max; double iat_mean; double iat_std; }; /* This data structure is used to demonstrate how to use the 'extension' * pointer to store custom data for a flow */ typedef struct ident { uint8_t init_dir; struct ident_stats in; struct ident_stats out; double start_ts; double last_ts; lpi_data_t lpi; } IdentFlow; static void *start_processing(libtrace_t *trace, libtrace_thread_t *thread, void *global) { bool opt_false = false; struct globalopts *opts = (struct globalopts *)global; struct threadlocal *tl = (struct threadlocal *)malloc(sizeof( struct threadlocal)); tl->flowmanager = new FlowManager(); /* This tells libflowmanager to ignore any flows where an RFC1918 * private IP address is involved */ if (tl->flowmanager->setConfigOption(LFM_CONFIG_IGNORE_RFC1918, &(opts->ignore_rfc1918)) == 0) { fprintf(stderr, "Failed to set IGNORE RFC 1918 option in libflowmanager\n"); } /* This tells libflowmanager not to replicate the TCP timewait * behaviour where closed TCP connections are retained in the Flow * map for an extra 2 minutes */ if (tl->flowmanager->setConfigOption(LFM_CONFIG_TCP_TIMEWAIT, &opt_false) == 0) { fprintf(stderr, "Failed to set TCP TIMEWAIT option in libflowmanager\n"); } /* This tells libflowmanager not to utilise the fast expiry rules for * short-lived UDP connections - these rules are experimental * behaviour not in line with recommended "best" practice */ if (tl->flowmanager->setConfigOption(LFM_CONFIG_SHORT_UDP, &opt_false) == 0) { fprintf(stderr, "Failed to set SHORT UDP option in libflowmanager\n"); } return tl; } static void *start_reporter(libtrace_t *trace, libtrace_thread_t *thread, void *global) { return NULL; } static void stop_reporter(libtrace_t *trace, libtrace_thread_t *thread, void *global, void *tls) { if (tls) free(tls); } /* Initialises the custom data for the given flow. Allocates memory for a * IdentFlow structure and ensures that the extension pointer points at * it. */ void init_ident_flow(Flow *f, uint8_t dir, double ts) { IdentFlow *ident = NULL; ident = (IdentFlow *) malloc(sizeof(IdentFlow)); memset(ident, 0, sizeof(IdentFlow)); ident->init_dir = dir; ident->start_ts = ts; ident->last_ts = ts; ident->in.pktlen_min = UINT16_MAX; ident->out.pktlen_min = UINT16_MAX; ident->in.iat_min = UINT32_MAX; ident->out.iat_min = UINT32_MAX; lpi_init_data(&ident->lpi); f->extension = ident; } static void dump_len_stats(struct ident_stats *is, char *space, int spacelen) { if (is->pkts == 0) { snprintf(space, spacelen - 1, ",0,0,0,0"); } else { snprintf(space, spacelen - 1, ",%u,%.0f,%u,%.0f", is->pktlen_min, is->pktlen_mean, is->pktlen_max, sqrt(is->pktlen_std / is->pkts)); } } static void dump_iat_stats(struct ident_stats *is, char *space, int spacelen) { if (is->pkts == 0) { snprintf(space, spacelen - 1, ",0,0,0,0"); } else { snprintf(space, spacelen - 1, ",%u,%.0f,%u,%.0f", is->iat_min, is->iat_mean, is->iat_max, sqrt(is->iat_std / is->pkts)); } } char *display_ident(Flow *f, IdentFlow *ident, struct globalopts *opts) { char s_ip[100]; char c_ip[100]; char len_stats_out[200]; char len_stats_in[200]; char iat_stats_out[200]; char iat_stats_in[200]; char *str; lpi_module_t *proto; if (opts->only_dir0 && ident->init_dir == 1) return NULL; if (opts->only_dir1 && ident->init_dir == 0) return NULL; if (opts->require_both) { if (ident->lpi.payload_len[0] == 0 || ident->lpi.payload_len[1] == 0) { return NULL; } } proto = lpi_guess_protocol(&ident->lpi); f->id.get_server_ip_str(s_ip); f->id.get_client_ip_str(c_ip); str = (char *)malloc(1000); dump_len_stats(&ident->out, len_stats_out, 200); dump_len_stats(&ident->in, len_stats_in, 200); dump_iat_stats(&ident->out, iat_stats_out, 200); dump_iat_stats(&ident->in, iat_stats_in, 200); /* basic statistics */ snprintf(str, 999, "%s,%d,%" PRIu64 ",%" PRIu64 ",%" PRIu64 ",%" PRIu64 "%s%s%s%s,%.0f,%f\n", proto->name, f->id.get_protocol(), ident->out.pkts, ident->out.bytes, ident->in.pkts, ident->in.bytes, len_stats_out, len_stats_in, iat_stats_out, iat_stats_in, (ident->last_ts - ident->start_ts) * 1000000.0, ident->start_ts); return str; } /* Expires all flows that libflowmanager believes have been idle for too * long. The exp_flag variable tells libflowmanager whether it should force * expiry of all flows (e.g. if you have reached the end of the program and * want the stats for all the still-active flows). Otherwise, only flows * that have been idle for longer than their expiry timeout will be expired. */ void expire_ident_flows(libtrace_t *trace, libtrace_thread_t *thread, struct globalopts *opts, FlowManager *fm, double ts, bool exp_flag) { Flow *expired; char *result = NULL; libtrace_generic_t gen; /* Loop until libflowmanager has no more expired flows available */ while ((expired = fm->expireNextFlow(ts, exp_flag)) != NULL) { IdentFlow *ident = (IdentFlow *)expired->extension; result = display_ident(expired, ident, opts); if (result) { gen.ptr = result; trace_publish_result(trace, thread, ts, gen, RESULT_USER); } /* Don't forget to free our custom data structure */ free(ident); fm->releaseFlow(expired); } } static void stop_processing(libtrace_t *trace, libtrace_thread_t *thread, void *global, void *tls) { struct globalopts *opts = (struct globalopts *)global; struct threadlocal *tl = (struct threadlocal *)tls; expire_ident_flows(trace, thread, opts, tl->flowmanager, 0, true); delete(tl->flowmanager); free(tl); } static void per_result(libtrace_t *trace, libtrace_thread_t *sender, void *global, void *tls, libtrace_result_t *result) { char *resultstr; if (result->type != RESULT_USER) return; resultstr = (char *)result->value.ptr; printf("%s", resultstr); free(resultstr); } /** Update flow statistics */ void per_packet_flow(libtrace_packet_t *packet, IdentFlow *ident, int dir, double ts) { struct ident_stats *is; int pktlen; uint32_t iat; double diff, mean, iatd; is = (dir == 0 ? &ident->out : &ident->in); /* basic statistics */ pktlen = trace_get_payload_length(packet); is->pkts++; is->bytes += pktlen; /* packet length statistics */ if (pktlen < is->pktlen_min) is->pktlen_min = pktlen; if (pktlen > is->pktlen_max) is->pktlen_max = pktlen; diff = pktlen - is->pktlen_mean; mean = is->pktlen_mean + diff / is->pkts; is->pktlen_std += diff * (pktlen - mean); is->pktlen_mean = mean; /* packet inter-arrival time */ iatd = ts - ident->last_ts; if (iatd < 0) { iat = 0; } else { /* convert to us */ iatd *= 1000000; if (iatd > UINT32_MAX) iat = UINT32_MAX; else iat = iatd; } if (iat < is->iat_min) is->iat_min = iat; if (iat > is->iat_max) is->iat_max = iat; diff = iat - is->iat_mean; mean = is->iat_mean + diff / is->pkts; is->iat_std += diff * (iat - mean); is->iat_mean = mean; /* update timestamp of last packet */ ident->last_ts = ts; } /** This function receives each packet from libtrace */ static libtrace_packet_t *per_packet(libtrace_t *trace, libtrace_thread_t *thread, void *global, void *tls, libtrace_packet_t *packet) { Flow *f; IdentFlow *ident = NULL; uint8_t dir = 255; bool is_new = false; libtrace_tcp_t *tcp = NULL; void *l3; double ts; uint16_t l3_type; struct globalopts *opts = (struct globalopts *)global; struct threadlocal *tl = (struct threadlocal *)tls; /* Libflowmanager only deals with IP traffic, so ignore anything * that does not have an IP header */ l3 = trace_get_layer3(packet, &l3_type, NULL); if (l3_type != TRACE_ETHERTYPE_IP && l3_type != TRACE_ETHERTYPE_IPV6) return packet; if (l3 == NULL) return packet; /* Expire all suitably idle flows */ ts = trace_get_seconds(packet); expire_ident_flows(trace, thread, opts, tl->flowmanager, ts, false); /* Determine packet direction * 0 is output, 1 is input */ switch (opts->dir_method) { case DIR_METHOD_TRACE: dir = trace_get_direction(packet); break; case DIR_METHOD_MAC: dir = mac_get_direction(packet, opts->mac_bytes); break; case DIR_METHOD_PORT: dir = port_get_direction(packet); } if (dir != 0 && dir != 1) return packet; /* Match the packet to a Flow - this will create a new flow if * there is no matching flow already in the Flow map and set the * is_new flag to true. */ f = tl->flowmanager->matchPacketToFlow(packet, dir, &is_new); /* Libflowmanager did not like something about that packet - best to * just ignore it and carry on */ if (f == NULL) { return packet; } tcp = trace_get_tcp(packet); /* If the returned flow is new, you will probably want to allocate and * initialise any custom data that you intend to track for the flow */ if (is_new) { init_ident_flow(f, dir, ts); ident = (IdentFlow *)f->extension; } else { ident = (IdentFlow *)f->extension; if (tcp && tcp->syn && !tcp->ack) ident->init_dir = dir; } /* Update flow statistics in ident */ per_packet_flow(packet, ident, dir, ts); /* Pass the packet into libprotoident so it can extract any info * it needs from this packet */ lpi_update_data(packet, &ident->lpi, dir); /* Tell libflowmanager to update the expiry time for this flow */ tl->flowmanager->updateFlowExpiry(f, packet, dir, ts); return packet; } static void cleanup_signal(int sig) { (void)sig; if (!done) { done = 1; trace_pstop(currenttrace); } } static void usage(char *prog) { printf("Usage details for %s\n\n", prog); printf("%s [-l ] [-T] [-b] [-d ] [-f ] [-R] [-t ] [-B buflen] inputURI [inputURI ...]\n\n", prog); printf("Options:\n"); printf(" -l Determine direction based on representing the 'inside'\n"); printf(" portion of the network\n"); printf(" -T Use trace direction tags to determine direction\n"); printf(" -b Ignore flows that do not send data in both directions \n"); printf(" -d Ignore flows where the initial packet does not match the given\n"); printf(" direction\n"); printf(" -f Ignore flows that do not match the given BPF filter\n"); printf(" -R Ignore flows involving private RFC 1918 address space\n"); printf(" -t Share the workload over the given number of threads\n"); printf(" -B Buffer results until there are results waiting\n"); exit(0); } int main(int argc, char *argv[]) { libtrace_filter_t *filter = NULL; struct sigaction sigact; struct globalopts opts; int threads = 1; int bufferresults = 10; int i, opt; double ts; char *filterstring = NULL; int dir; libtrace_callback_set_t *processing, *reporter; opts.dir_method = DIR_METHOD_PORT; opts.only_dir0 = false; opts.only_dir1 = false; opts.require_both = false; opts.nat_hole = false; opts.ignore_rfc1918 = false; opts.local_mac = NULL; processing = trace_create_callback_set(); trace_set_starting_cb(processing, start_processing); trace_set_stopping_cb(processing, stop_processing); trace_set_packet_cb(processing, per_packet); reporter = trace_create_callback_set(); trace_set_starting_cb(reporter, start_reporter); trace_set_stopping_cb(reporter, stop_reporter); trace_set_result_cb(reporter, per_result); while ((opt = getopt(argc, argv, "l:bB:d:f:RhTt:")) != EOF) { switch (opt) { case 'l': opts.local_mac = optarg; opts.dir_method = DIR_METHOD_MAC; break; case 'b': opts.require_both = true; break; case 'B': bufferresults = atoi(optarg); if (bufferresults <= 0) bufferresults = 1; break; case 'd': dir = atoi(optarg); if (dir == 0) opts.only_dir0 = true; if (dir == 1) opts.only_dir1 = true; break; case 'f': filterstring = optarg; break; case 'R': opts.ignore_rfc1918 = true; break; case 'T': opts.dir_method = DIR_METHOD_TRACE; break; case 't': threads = atoi(optarg); if (threads <= 0) threads = 1; break; case 'h': default: usage(argv[0]); } } if (filterstring != NULL) { filter = trace_create_filter(filterstring); } if (opts.local_mac != NULL) { if (convert_mac_string(opts.local_mac, opts.mac_bytes) < 0) { fprintf(stderr, "Invalid MAC: %s\n", opts.local_mac); return 1; } } sigact.sa_handler = cleanup_signal; sigemptyset(&sigact.sa_mask); sigact.sa_flags = SA_RESTART; sigaction(SIGINT, &sigact, NULL); sigaction(SIGTERM, &sigact, NULL); signal(SIGINT,&cleanup_signal); signal(SIGTERM,&cleanup_signal); if (lpi_init_library() == -1) return -1; for (i = optind; i < argc; i++) { if (done) break; fprintf(stderr, "%s\n", argv[i]); /* printf arff file header */ printf("@relation '%s'\n", argv[i]); printf("\n"); printf("@attribute label string\n"); printf("@attribute protocol numeric\n"); printf("@attribute fpackets numeric\n"); printf("@attribute fbytes numeric\n"); printf("@attribute bpackets numeric\n"); printf("@attribute bbytes numeric\n"); printf("@attribute minfpktl numeric\n"); printf("@attribute meanfpktl numeric\n"); printf("@attribute maxfpktl numeric\n"); printf("@attribute stdfpktl numeric\n"); printf("@attribute minbpktl numeric\n"); printf("@attribute meanbpktl numeric\n"); printf("@attribute maxbpktl numeric\n"); printf("@attribute stdbpktl numeric\n"); printf("@attribute minfiat numeric\n"); printf("@attribute meanfiat numeric\n"); printf("@attribute maxfiat numeric\n"); printf("@attribute stdfiat numeric\n"); printf("@attribute minbiat numeric\n"); printf("@attribute meanbiat numeric\n"); printf("@attribute maxbiat numeric\n"); printf("@attribute stdbiat numeric\n"); printf("@attribute duration numeric\n"); printf("@attribute timestamp numeric\n"); printf("\n"); printf("@data\n"); /* Bog-standard libtrace stuff for reading trace files */ currenttrace = trace_create(argv[i]); if (!currenttrace) { perror("Creating libtrace trace"); return -1; } if (trace_is_err(currenttrace)) { trace_perror(currenttrace, "Opening trace file"); trace_destroy(currenttrace); continue; } if (filter && trace_config(currenttrace, TRACE_OPTION_FILTER, filter) == -1) { trace_perror(currenttrace, "Configuring filter"); trace_destroy(currenttrace); return -1; } trace_set_perpkt_threads(currenttrace, threads); trace_set_reporter_thold(currenttrace, bufferresults); trace_set_combiner(currenttrace, &combiner_unordered, (libtrace_generic_t){0}); trace_set_hasher(currenttrace, HASHER_BIDIRECTIONAL, NULL, NULL); if (trace_pstart(currenttrace, &opts, processing, reporter) == -1) { trace_perror(currenttrace, "Starting trace"); trace_destroy(currenttrace); continue; } trace_join(currenttrace); trace_destroy(currenttrace); } trace_destroy_callback_set(processing); trace_destroy_callback_set(reporter); lpi_free_library(); return 0; } ================================================ FILE: tools/find_unknown/Makefile.am ================================================ bin_PROGRAMS=lpi_find_unknown man_MANS = lpi_find_unknown.1 EXTRA_DIST = $(man_MANS) include ../Makefile.tools lpi_find_unknown_SOURCES=lpi_find_unknown.cc ../tools_common.cc lpi_find_unknown_LDADD = @ADD_LIBS@ -lprotoident ================================================ FILE: tools/find_unknown/lpi_find_unknown.1 ================================================ .TH LPI_FIND_UNKNOWN "1" "April 2019" "libprotoident" "User Commands" .SH NAME lpi_find_unknown \- list all network flows in a trace that libprotoident cannot identify .SH SYNOPSIS .B lpi_find_unknown inputuri .SH DESCRIPTION This tool attempts to identify each individual flow within the provided network packet trace that libprotoident is unable to provide a positive classification result for. This is mainly useful in situations where one is looking to add support for new protocols to libprotoident, but the tool has been made available nonetheless. Note that identification only occurs when the flow has concluded or expired due to inactivity, so it is not very effective for real-time use cases. .PP The \fBinputuri\fR argument must be a valid libtrace URI. .SH OUTPUT FORMAT For each flow discovered in the input trace which libprotoident is unable to identify, a single line is printed to stdout describing the flow. The line contains the following whitespace separated field (in order): .nf * IP address of the first endpoint * IP address of the second endpoint * Port used by the first endpoint * Port used by the second endpoint * Transport protocol (6 = TCP, 17 = UDP) * Unix timestamp when the flow began * Unix timestamp when the flow ended * Total bytes sent from first endpoint to second endpoint * Total bytes sent from second endpoint to first endpoint * First four bytes of payload sent from first endpoint (in hex) * First four bytes of payload sent from first endpoint (ASCII) * Size of first payload-bearing packet sent from first endpoint * First four bytes of payload sent from second endpoint (in hex) * First four bytes of payload sent from second endpoint (ASCII) * Size of first payload-bearing packet sent from second endpoint .fi .SH LINKS More details about libprotoident, the protocols it supports and how it works can be found at https://github.com/wanduow/libprotoident/wiki .SH SEE ALSO lpi_arff(1), lpi_protoident(1) .SH AUTHORS Shane Alcock ================================================ FILE: tools/find_unknown/lpi_find_unknown.cc ================================================ /* * This file is part of libprotoident * * Copyright (c) 2011-2015 The University of Waikato, Hamilton, New Zealand. * Author: Shane Alcock * * With contributions from: * Aaron Murrihy * Donald Neal * * All rights reserved. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with libprotoident; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id$ */ #define __STDC_FORMAT_MACROS #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../tools_common.h" enum { DIR_METHOD_TRACE, DIR_METHOD_MAC, DIR_METHOD_PORT }; libtrace_t *currenttrace; static volatile int done = 0; struct globalopts { int dir_method; bool only_dir0 ; bool only_dir1 ; bool require_both ; bool nat_hole ; bool ignore_rfc1918 ; char *local_mac ; uint8_t mac_bytes[6]; }; struct threadlocal { FlowManager *flowmanager; }; /* This data structure is used to demonstrate how to use the 'extension' * pointer to store custom data for a flow */ typedef struct ident { uint8_t init_dir; uint64_t in_bytes; uint64_t out_bytes; uint64_t in_pkts; uint64_t out_pkts; double start_ts; double end_ts; lpi_data_t lpi; } IdentFlow; static void *start_processing(libtrace_t *trace, libtrace_thread_t *thread, void *global) { bool opt_false = false; struct globalopts *opts = (struct globalopts *)global; struct threadlocal *tl = (struct threadlocal *)malloc(sizeof( struct threadlocal)); tl->flowmanager = new FlowManager(); /* This tells libflowmanager to ignore any flows where an RFC1918 * private IP address is involved */ if (tl->flowmanager->setConfigOption(LFM_CONFIG_IGNORE_RFC1918, &(opts->ignore_rfc1918)) == 0) { fprintf(stderr, "Failed to set IGNORE RFC 1918 option in libflowmanager\n"); } /* This tells libflowmanager not to replicate the TCP timewait * behaviour where closed TCP connections are retained in the Flow * map for an extra 2 minutes */ if (tl->flowmanager->setConfigOption(LFM_CONFIG_TCP_TIMEWAIT, &opt_false) == 0) { fprintf(stderr, "Failed to set TCP TIMEWAIT option in libflowmanager\n"); } /* This tells libflowmanager not to utilise the fast expiry rules for * short-lived UDP connections - these rules are experimental * behaviour not in line with recommended "best" practice */ if (tl->flowmanager->setConfigOption(LFM_CONFIG_SHORT_UDP, &opt_false) == 0) { fprintf(stderr, "Failed to set SHORT UDP option in libflowmanager\n"); } return tl; } static void *start_reporter(libtrace_t *trace, libtrace_thread_t *thread, void *global) { return NULL; } static void stop_reporter(libtrace_t *trace, libtrace_thread_t *thread, void *global, void *tls) { if (tls) free(tls); } /* Initialises the custom data for the given flow. Allocates memory for a * IdentFlow structure and ensures that the extension pointer points at * it. */ void init_ident_flow(Flow *f, uint8_t dir, double ts) { IdentFlow *ident = NULL; ident = (IdentFlow *)malloc(sizeof(IdentFlow)); ident->init_dir = dir; ident->in_bytes = 0; ident->out_bytes = 0; ident->in_pkts = 0; ident->out_pkts = 0; ident->start_ts = ts; ident->end_ts = ts; lpi_init_data(&ident->lpi); f->extension = ident; } void dump_payload(lpi_data_t lpi, uint8_t dir, char *space, int spacelen) { int i; uint8_t *pl = (uint8_t *)(&(lpi.payload[dir])); char ascii[4][5]; for (i = 0; i < 4; i++) { if (*pl > 32 && *pl < 126) { snprintf(ascii[i], 5, "%c", *pl); } else { snprintf(ascii[i], 5, "."); } pl ++; } snprintf(space, spacelen - 1, "%08x %s%s%s%s %u", ntohl(lpi.payload[dir]), ascii[0], ascii[1], ascii[2], ascii[3], lpi.payload_len[dir]); } char *display_ident(Flow *f, IdentFlow *ident, struct globalopts *opts) { char s_ip[100]; char c_ip[100]; char pload_out[100]; char pload_in[100]; char *str; lpi_module_t *proto; if (opts->only_dir0 && ident->init_dir == 1) return NULL; if (opts->only_dir1 && ident->init_dir == 0) return NULL; if (opts->require_both) { if (ident->lpi.payload_len[0] == 0 || ident->lpi.payload_len[1] == 0) { return NULL; } } if (opts->nat_hole) { if (ident->init_dir != 1) return NULL; if (ident->lpi.payload_len[0] == 0 && ident->in_pkts <= 3) return NULL; } proto = lpi_guess_protocol(&ident->lpi); if (proto->protocol != LPI_PROTO_UNKNOWN && proto->protocol != LPI_PROTO_UDP) { return NULL; } f->id.get_server_ip_str(s_ip); f->id.get_client_ip_str(c_ip); dump_payload(ident->lpi, 0, pload_out, 100); dump_payload(ident->lpi, 1, pload_in, 100); str = (char *)malloc(750); snprintf(str, 750, "%s %s %u %u %u %.3f %.3f %" PRIu64 " %" PRIu64 " %s %s\n", s_ip, c_ip, f->id.get_server_port(), f->id.get_client_port(), f->id.get_protocol(), ident->start_ts, ident->end_ts, ident->out_bytes, ident->in_bytes, pload_out, pload_in); return str; } /* Expires all flows that libflowmanager believes have been idle for too * long. The exp_flag variable tells libflowmanager whether it should force * expiry of all flows (e.g. if you have reached the end of the program and * want the stats for all the still-active flows). Otherwise, only flows * that have been idle for longer than their expiry timeout will be expired. */ void expire_ident_flows(libtrace_t *trace, libtrace_thread_t *thread, struct globalopts *opts, FlowManager *fm, double ts, bool exp_flag) { Flow *expired; char *result = NULL; libtrace_generic_t gen; /* Loop until libflowmanager has no more expired flows available */ while ((expired = fm->expireNextFlow(ts, exp_flag)) != NULL) { IdentFlow *ident = (IdentFlow *)expired->extension; result = display_ident(expired, ident, opts); if (result) { gen.ptr = result; trace_publish_result(trace, thread, ident->end_ts, gen, RESULT_USER); } /* Don't forget to free our custom data structure */ free(ident); fm->releaseFlow(expired); } } static void stop_processing(libtrace_t *trace, libtrace_thread_t *thread, void *global, void *tls) { struct globalopts *opts = (struct globalopts *)global; struct threadlocal *tl = (struct threadlocal *)tls; expire_ident_flows(trace, thread, opts, tl->flowmanager, 0, true); delete(tl->flowmanager); free(tl); } static void per_result(libtrace_t *trace, libtrace_thread_t *sender, void *global, void *tls, libtrace_result_t *result) { char *resultstr; if (result->type != RESULT_USER) return; resultstr = (char *)result->value.ptr; printf("%s", resultstr); free(resultstr); } static libtrace_packet_t *per_packet(libtrace_t *trace, libtrace_thread_t *thread, void *global, void *tls, libtrace_packet_t *packet) { Flow *f; IdentFlow *ident = NULL; uint8_t dir = 255; bool is_new = false; libtrace_tcp_t *tcp = NULL; void *l3; double ts; uint16_t l3_type; struct globalopts *opts = (struct globalopts *)global; struct threadlocal *tl = (struct threadlocal *)tls; /* Libflowmanager only deals with IP traffic, so ignore anything * that does not have an IP header */ l3 = trace_get_layer3(packet, &l3_type, NULL); if (l3_type != TRACE_ETHERTYPE_IP && l3_type != TRACE_ETHERTYPE_IPV6) return packet; if (l3 == NULL) return packet; /* Expire all suitably idle flows */ ts = trace_get_seconds(packet); expire_ident_flows(trace, thread, opts, tl->flowmanager, ts, false); /* Determine packet direction */ if (opts->dir_method == DIR_METHOD_TRACE) { dir = trace_get_direction(packet); } if (opts->dir_method == DIR_METHOD_MAC) { dir = mac_get_direction(packet, opts->mac_bytes); } if (opts->dir_method == DIR_METHOD_PORT) { dir = port_get_direction(packet); } if (dir != 0 && dir != 1) return packet; /* Match the packet to a Flow - this will create a new flow if * there is no matching flow already in the Flow map and set the * is_new flag to true. */ f = tl->flowmanager->matchPacketToFlow(packet, dir, &is_new); /* Libflowmanager did not like something about that packet - best to * just ignore it and carry on */ if (f == NULL) { return packet; } tcp = trace_get_tcp(packet); /* If the returned flow is new, you will probably want to allocate and * initialise any custom data that you intend to track for the flow */ if (is_new) { init_ident_flow(f, dir, ts); ident = (IdentFlow *)f->extension; } else { ident = (IdentFlow *)f->extension; if (tcp && tcp->syn && !tcp->ack) ident->init_dir = dir; if (ident->end_ts < ts) ident->end_ts = ts; } /* Update our own byte and packet counters for reporting purposes */ if (dir == 0) { ident->out_pkts += 1; ident->out_bytes += trace_get_payload_length(packet); } else { ident->in_bytes += trace_get_payload_length(packet); ident->in_pkts += 1; } /* Pass the packet into libprotoident so it can extract any info * it needs from this packet */ lpi_update_data(packet, &ident->lpi, dir); assert(f); /* Tell libflowmanager to update the expiry time for this flow */ tl->flowmanager->updateFlowExpiry(f, packet, dir, ts); return packet; } static void cleanup_signal(int sig) { (void)sig; if (!done) { trace_pstop(currenttrace); done = 1; } } static void usage(char *prog) { printf("Usage details for %s\n\n", prog); printf("%s [-l ] [-T] [-b] [-d ] [-f ] [-R] [-H] [-t ] [-B Determine direction based on representing the 'inside' \n portion of the network\n"); printf(" -T Use trace direction tags to determine direction\n"); printf(" -b Ignore flows that do not send data in both directions \n"); printf(" -d Ignore flows where the initial packet does not match the given \n direction\n"); printf(" -f Ignore flows that do not match the given BPF filter\n"); printf(" -R Ignore flows involving private RFC 1918 address space\n"); printf(" -H Ignore flows that do not meet the criteria for an SPNAT hole\n"); printf(" -t Share the workload over the given number of threads\n"); printf(" -B Buffer results until there are results waiting\n"); exit(0); } int main(int argc, char *argv[]) { libtrace_filter_t *filter = NULL; struct sigaction sigact; struct globalopts opts; int i, opt; char *filterstring = NULL; int dir; int threads = 1; int bufferresults = 1; libtrace_callback_set_t *processing, *reporter; opts.dir_method = DIR_METHOD_PORT; opts.only_dir0 = false; opts.only_dir1 = false; opts.require_both = false; opts.nat_hole = false; opts.ignore_rfc1918 = false; opts.local_mac = NULL; processing = trace_create_callback_set(); trace_set_starting_cb(processing, start_processing); trace_set_stopping_cb(processing, stop_processing); trace_set_packet_cb(processing, per_packet); reporter = trace_create_callback_set(); trace_set_starting_cb(reporter, start_reporter); trace_set_stopping_cb(reporter, stop_reporter); trace_set_result_cb(reporter, per_result); while ((opt = getopt(argc, argv, "l:bB:Hd:f:RhTt:")) != EOF) { switch (opt) { case 'l': opts.local_mac = optarg; opts.dir_method = DIR_METHOD_MAC; break; case 'b': opts.require_both = true; break; case 'B': bufferresults = atoi(optarg); if (bufferresults <= 0) bufferresults = 1; break; case 'd': dir = atoi(optarg); if (dir == 0) opts.only_dir0 = true; if (dir == 1) opts.only_dir1 = true; break; case 'f': filterstring = optarg; break; case 'R': opts.ignore_rfc1918 = true; break; case 'H': opts.nat_hole = true; break; case 'T': opts.dir_method = DIR_METHOD_TRACE; break; case 't': threads = atoi(optarg); if (threads <= 0) threads = 1; break; case 'h': default: usage(argv[0]); } } if (filterstring != NULL) { filter = trace_create_filter(filterstring); } if (opts.local_mac != NULL) { if (convert_mac_string(opts.local_mac, opts.mac_bytes) < 0) { fprintf(stderr, "Invalid MAC: %s\n", opts.local_mac); return 1; } } sigact.sa_handler = cleanup_signal; sigemptyset(&sigact.sa_mask); sigact.sa_flags = SA_RESTART; sigaction(SIGINT, &sigact, NULL); sigaction(SIGTERM, &sigact, NULL); signal(SIGINT,&cleanup_signal); signal(SIGTERM,&cleanup_signal); if (lpi_init_library() == -1) return -1; for (i = optind; i < argc; i++) { if (done) break; fprintf(stderr, "%s\n", argv[i]); /* Bog-standard libtrace stuff for reading trace files */ currenttrace = trace_create(argv[i]); if (!currenttrace) { perror("Creating libtrace trace"); return -1; } if (trace_is_err(currenttrace)) { trace_perror(currenttrace, "Opening trace file"); trace_destroy(currenttrace); continue; } if (filter && trace_config(currenttrace, TRACE_OPTION_FILTER, filter) == -1) { trace_perror(currenttrace, "Configuring filter"); trace_destroy(currenttrace); return -1; } trace_set_perpkt_threads(currenttrace, threads); trace_set_reporter_thold(currenttrace, bufferresults); trace_set_combiner(currenttrace, &combiner_unordered, (libtrace_generic_t){0}); trace_set_hasher(currenttrace, HASHER_BIDIRECTIONAL, NULL, NULL); if (trace_pstart(currenttrace, &opts, processing, reporter) == -1) { trace_perror(currenttrace, "Starting trace"); trace_destroy(currenttrace); continue; } trace_join(currenttrace); trace_destroy(currenttrace); } trace_destroy_callback_set(processing); trace_destroy_callback_set(reporter); lpi_free_library(); return 0; } ================================================ FILE: tools/live/Makefile.am ================================================ bin_PROGRAMS=lpi_live #include_HEADERS=lpicp.h lpicp_export.h include ../Makefile.tools lpi_live_SOURCES=lpi_live.cc live_common.cc ../tools_common.cc lpi_live_LDADD = @ADD_LIBS@ -lprotoident -lpacketdump #if BUILD_COLLECTOR #bin_PROGRAMS+=lpi_collector #lpi_collector_SOURCES=collector.cc live_common.cc ../tools_common.cc lpicp.cc \ # lpicp_export.cc #lpi_collector_LDADD = @ADD_LIBS@ -lprotoident -lpacketdump -lwandevent #endif ================================================ FILE: tools/live/collector.cc ================================================ /* * This file is part of libprotoident * * Copyright (c) 2012 The University of Waikato, Hamilton, New Zealand. * Author: Meenakshee Mungro * * All rights reserved. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with libprotoident; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id$ */ #define __STDC_FORMAT_MACROS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../tools_common.h" #include "live_common.h" #include "lpicp_export.h" #include "lpicp.h" wand_event_handler_t *ev_hdl = NULL; enum { DIR_METHOD_TRACE, DIR_METHOD_MAC, DIR_METHOD_PORT }; int dir_method = DIR_METHOD_TRACE; char *local_mac = NULL; uint8_t mac_bytes[6]; libtrace_t *trace = NULL; libtrace_packet_t *packet = NULL; uint32_t report_freq = 300; char* local_id = (char*) "unnamed"; /* A file descriptor event - used when waiting on input from a live interface */ struct wand_fdcb_t fd_cb; struct wand_fdcb_t socket_cb; /* A timer event - used when waiting for the next packet to occur in a trace * file replay */ struct wand_timer_t packet_timer; /* Timer that fires every n seconds, where n is the interval at which output is * produced */ struct wand_timer_t output_timer; /* Signal event which is triggered when the user triggers a SIGINT */ struct wand_signal_t signal_sigint; /* Struct that stores the time at which the reporting period started */ struct timeval start_reporting_period; static volatile int done = 0; /* Structure which contains all the current values for all the statistics the * collector needs to track. */ LiveCounters counts; /* Function prototype */ void collect_packets(libtrace_t *trace, libtrace_packet_t *packet ); void usage(char *prog) { return; } /* Function which prints the stats to the console every n seconds, where n is a * value provided in the command line arguments */ void output_stats(struct wand_timer_t *timer) { struct timeval *tv; tv = (struct timeval *) timer->data; output_timer.expire = wand_calc_expire(ev_hdl, report_freq, 0); output_timer.callback = output_stats; gettimeofday(&start_reporting_period, NULL); output_timer.data = &start_reporting_period; /* the timer will be inserted into a doubly linked list and pointers * should start out as NULL */ output_timer.prev = output_timer.next = NULL; wand_add_timer(ev_hdl, &output_timer); lpicp_export_counters(&counts, start_reporting_period, local_id, report_freq); reset_counters(&counts, false); } /* Expires all flows that libflowmanager believes have been idle for too * long. The exp_flag variable tells libflowmanager whether it should force * expiry of all flows (e.g. if you have reached the end of the program and * want the stats for all the still-active flows). Otherwise, only flows * that have been idle for longer than their expiry timeout will be expired. */ void expire_live_flows(double ts, bool exp_flag) { Flow *expired; /* Loop until libflowmanager has no more expired flows available */ while ((expired = lfm_expire_next_flow(ts, exp_flag)) != NULL) { LiveFlow *live = (LiveFlow *)expired->extension; destroy_live_flow(live, &counts); /* VERY IMPORTANT: delete the Flow structure itself, even * though we did not directly allocate the memory ourselves */ lfm_release_flow(expired); } } /* Function which processes a packet after it is read from the trace. * It expires any old flows that are due to expire, takes the current packet * and matches it to the flow it belongs to, checks if it is a new flow and acts * accordingly, updates the state properly by checking if it is a TCP flow, and * updates the expiry time for the current flow. */ void process_packet(libtrace_packet_t *packet) { uint8_t dir = 255; Flow *f; LiveFlow *live = NULL; bool is_new = false; /* Defines a tcp header structure */ libtrace_tcp_t *tcp = NULL; void *l3; double ts; uint16_t l3_type = 0; l3 = trace_get_layer3(packet, &l3_type, NULL); /* if the packet is not an IPv4 or IPv6 packet */ if (l3_type != TRACE_ETHERTYPE_IP && l3_type != TRACE_ETHERTYPE_IPV6) return; if (l3 == NULL) return; /* Expire all suitably idle flows */ ts = trace_get_seconds(packet); expire_live_flows(ts, false); /* Determine packet direction */ if (dir_method == DIR_METHOD_TRACE) { dir = trace_get_direction(packet); } if (dir_method == DIR_METHOD_MAC) { dir = mac_get_direction(packet, mac_bytes); } if (dir_method == DIR_METHOD_PORT) { dir = port_get_direction(packet); } if (dir != 0 && dir != 1) return; /* Match the packet to a Flow - this will create a new flow if * there is no matching flow already in the Flow map and set the * is_new flag to true */ f = lfm_match_packet_to_flow(packet, dir, &is_new); /* Libflowmanager did not like something about that packet - best to * just ignore it and carry on */ if (f == NULL) { return; } tcp = trace_get_tcp(packet); /* If the returned flow is new, allocate and initialise any custom data * that needs to be tracked for the flow */ if (is_new) { init_live_flow(&counts, f, dir, ts); live = (LiveFlow *)f->extension; } else { live = (LiveFlow *)f->extension; } /* Call method which updates the statistics stored in the LiveFlow * structure, based on the provided packet */ update_liveflow_stats(live, packet, &counts, dir); /* Pass the packet into libprotolive so that it can extract any * info it needs from this packet */ lpi_update_data(packet, &live->lpi, dir); if (update_protocol_counters( live, &counts, trace_get_wire_length(packet), trace_get_payload_length(packet), dir) == -1) { trace_dump_packet(packet); } /* Update TCP state for TCP flows. The TCP state determines how long * the flow can be idle before being expired by libflowmanager. For * instance, flows for which we have only seen a SYN will expire much * quicker than a TCP connection that has completed the handshake */ if (tcp) { lfm_check_tcp_flags(f, tcp, dir, ts); } /* Tell libflowmanager to update the expiry time for this flow */ lfm_update_flow_expiry_timeout(f, ts); } /* File descriptor callback method which is executed when a fd is added */ void source_read_event( struct wand_fdcb_t *event, enum wand_eventtype_t event_type) { wand_del_event(ev_hdl, event); /* Not very nice if this fails but it really REALLY shouldn't fail */ assert(event_type == EV_READ); collect_packets(trace, packet); } /* Callback function for packet_timer which is executed when the timer fires */ void sleep_timer_event(struct wand_timer_t *timer) { collect_packets(trace, packet); } /* Function which handles a SIGINT by deleting the signal and halting execution * of the program */ static void cleanup_signal(struct wand_signal_t *signal ) { wand_del_signal(signal); fprintf(stdout, "%s\n", "Terminating program..."); done = 1; ev_hdl->running = false; } /* Function which processes a libtrace event and executes the appropriate code * for each event type */ int process_event(libtrace_eventobj_t event, libtrace_packet_t *packet) { switch(event.type) { /* wait on a file descriptor(comes up when working with a live * source) */ case TRACE_EVENT_IOWAIT: fd_cb.fd = event.fd; /* only catering to READ events */ fd_cb.flags = EV_READ; fd_cb.data = NULL; fd_cb.callback = source_read_event; wand_add_event(ev_hdl, &fd_cb); /* Stop the current poll loop */ return 0; /* this event type comes up with static trace files */ case TRACE_EVENT_SLEEP: /* Next packet will be available in N seconds, sleep * until then */ int micros; micros = (int)((event.seconds - (int)event.seconds) * 1000000.0); packet_timer.expire = wand_calc_expire(ev_hdl, (int)event.seconds, micros); packet_timer.callback = sleep_timer_event; packet_timer.data = NULL; /* the timer will be inserted into a doubly linked list * and pointers should start out as NULL */ packet_timer.prev = packet_timer.next = NULL; wand_add_timer(ev_hdl, &packet_timer); return 0; case TRACE_EVENT_PACKET: /* A packet is available - pass it on to the meter */ if (event.size == -1) { /* Error occured */ /* We don't need wdcap's fancy error handling - * just drop the trace */ ev_hdl->running = false; return 0; } /* No error, so call function which processes packets */ process_packet(packet); /* check for more packets */ return 1; case TRACE_EVENT_TERMINATE: /* The input trace has terminated */ ev_hdl->running = false; return 0; default: fprintf(stderr, "Unknown libtrace event type: %d\n", event.type); return 0; } } /* Function which polls the trace for the next packet if available */ void collect_packets(libtrace_t *trace, libtrace_packet_t *packet ) { struct libtrace_eventobj_t event; int poll_again = 1; do { if (done) return; /* Process the next libtrace event from an input trace and * return a libtrace_event struct containing the event type and * details of the event */ event = trace_event(trace, packet); /* process_event returns 1(allows resuming packet checking) or * 0(stops polling) */ poll_again = process_event(event, packet); } while (poll_again); } int main(int argc, char *argv[]) { int opt, i; libtrace_filter_t *filter = NULL; char *filterstring = NULL; bool opt_false = false; bool ignore_rfc1918 = false; /* The default number of clients that can be connected to the server at a time. * Can be set when starting the server */ int max_clients = 20; struct sockaddr_in addr; int sock, sa_len = sizeof(struct sockaddr_in); int sockopt = 1; sock = socket(PF_INET, SOCK_STREAM, 0); if (sock == -1) { perror ("socket"); return -1; } if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &sockopt, sizeof(sockopt)) == -1) { perror("setsockopt (SO_REUSEADDR)"); return -1; } addr.sin_family = AF_INET; memset(addr.sin_zero, 0, sizeof(addr.sin_zero)); addr.sin_port = htons(3678); /* Bind to all local IPv4 addresses */ addr.sin_addr.s_addr = INADDR_ANY; /* Bind the socket to the port */ if (bind(sock, (struct sockaddr *)&addr, sa_len) == -1) { perror("bind"); return -1; } /* Start listening for inbound connections */ if (listen(sock, 10) == -1) { perror("listen"); return -1; } /* Initialise libwandevent */ if (wand_event_init() == -1) { fprintf(stderr, "Error initialising libwandevent\n"); return -1; } /* create an event handler */ ev_hdl = wand_create_event_handler(); if (ev_hdl == NULL) { fprintf(stderr, "Error creating event handler\n"); return -1; } /* Add listening fd to libwandevent */ socket_cb.fd = sock; socket_cb.flags = EV_READ; socket_cb.data = NULL; socket_cb.callback = accept_connections; wand_add_event(ev_hdl, &socket_cb); /* event handler has been correctly created, so add a signal event for SIGINT */ signal_sigint.signum = SIGINT; signal_sigint.data = NULL; signal_sigint.callback = cleanup_signal; wand_add_signal(&signal_sigint); if (argc < 2) { usage(argv[0]); return 1; } while ((opt = getopt(argc, argv, "f:l:i:r:c:TPR")) != EOF) { switch (opt) { /* Ignore flows that do not match the given BPF filter */ case 'f': filterstring = optarg; break; /* Determine direction based on representing the * 'inside' portion of the network */ case 'l': local_mac = optarg; dir_method = DIR_METHOD_MAC; break; /* Store string that will identify this particular * measurement process, e.g. source of the packets */ case 'i': local_id = optarg; break; /* Store the number of seconds that have passed since * the counters were last reset */ case 'r': report_freq = atoi(optarg); break; /* The maximum number of clients that can connect to the * server. * Defaults to 20 if the option is not set */ case 'c': max_clients = atoi(optarg); break; /* Use trace direction tags to determine direction */ case 'T': dir_method = DIR_METHOD_TRACE; break; /* Use port number to determine direction */ case 'P': dir_method = DIR_METHOD_PORT; break; /* ignore any flows where an RFC1918 private IP address * is involved */ case 'R': ignore_rfc1918 = true; break; default: usage(argv[0]); } } /* set the size of the array that stores client file descriptors */ create_client_array(max_clients); // if -l was specified in the command line args if (local_mac != NULL) { if (convert_mac_string(local_mac, mac_bytes) < 0) { fprintf(stderr, "Invalid MAC: %s\n", local_mac); return 1; } } /* This tells libflowmanager to ignore any flows where an RFC1918 * private IP address is involved */ if (lfm_set_config_option(LFM_CONFIG_IGNORE_RFC1918, &ignore_rfc1918) == 0) return -1; /* This tells libflowmanager not to replicate the TCP timewait behaviour * where closed TCP connections are retained in the Flow map for an * extra 2 minutes */ if (lfm_set_config_option(LFM_CONFIG_TCP_TIMEWAIT, &opt_false) == 0) return -1; /* This tells libflowmanager not to utilise the fast expiry rules for * short-lived UDP connections - these rules are experimental behaviour * not in line with recommended "best" practice */ if (lfm_set_config_option(LFM_CONFIG_SHORT_UDP, &opt_false) == 0) return -1; if (optind + 1 > argc) { usage(argv[0]); return 1; } if (lpi_init_library() == -1) return -1; /* nothing has gone wrong yet, so create packet */ packet = trace_create_packet(); if (filterstring) { filter = trace_create_filter(filterstring); } output_timer.expire = wand_calc_expire(ev_hdl, report_freq, 0); output_timer.callback = output_stats; gettimeofday(&start_reporting_period, NULL); output_timer.data = &start_reporting_period; output_timer.prev = output_timer.next = NULL ; wand_add_timer(ev_hdl, &output_timer); for (i = optind; i < argc; i++) { /* Create an input trace from a URI provided in arguments and * return a pointer to a libtrace_t */ trace = trace_create(argv[i]); if (trace_is_err(trace)) { /* outputs the error message for an input trace to * stderr and clear the error status. */ trace_perror(trace,"Opening trace file"); return 1; } if (filter && trace_config(trace, TRACE_OPTION_FILTER, filter) == -1) { trace_perror(trace, "trace_config(filter)"); return 1; } // Start an input trace and returns 0 on success, -1 on failure if (trace_start(trace)) { trace_perror(trace,"Starting trace"); trace_destroy(trace); return 1; } /* as long as this is true, libwandevent will keep running */ ev_hdl->running = true; collect_packets(trace, packet); /* Once we hit a wait event, fire up the event handler. We * won't fall out of this function call until we reach the * end of the trace or something goes awry with reading * the trace */ wand_event_run(ev_hdl); /* if there's an error after the event handler has started */ if (trace_is_err(trace)) { trace_perror(trace,"Reading packets"); trace_destroy(trace); return 1; } if (done) break; /* Close an input trace, freeing up any resources it may have * been using */ trace_destroy(trace); } /* cleaning up resources and final exporting of flows */ if (filter) trace_destroy_filter(filter); trace_destroy_packet(packet); wand_destroy_event_handler(ev_hdl); expire_live_flows(0, true); lpi_free_library(); close(sock); return 0; } ================================================ FILE: tools/live/live_common.cc ================================================ /* * This file is part of libprotoident * * Copyright (c) 2011 The University of Waikato, Hamilton, New Zealand. * Author: Shane Alcock * * With contributions from: * Aaron Murrihy * Donald Neal * * All rights reserved. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with libprotoident; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id$ */ /* The basis of this code was taken from the lpi_live tool and moved into a * separate source file that could be shared between the original tool and our * new collector. */ #define __STDC_FORMAT_MACROS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "live_common.h" /* These macros should make this code a lot more readable */ #define PROTONUM (live->proto->protocol) #define OUT_BYTES (cnt->out_byte_count) #define IN_BYTES (cnt->in_byte_count) #define OUT_PKTS (cnt->out_pkt_count) #define IN_PKTS (cnt->in_pkt_count) #define OUT_NEW (cnt->out_flow_count) #define IN_NEW (cnt->in_flow_count) #define OUT_CURR (cnt->out_current_flows) #define IN_CURR (cnt->in_current_flows) #define OUT_PEAK (cnt->out_peak_flows) #define IN_PEAK (cnt->in_peak_flows) static void wipe_local_ip_collectors(IPMap *ipmap) { IPMap::iterator ii = ipmap->begin(); while (ii != ipmap->end()) { IPMap::iterator tmp = ii; ii ++; ipmap->erase(tmp); } assert(ipmap->empty()); } static void reset_local_ip_counts(uint64_t *counts, IPMap *ipmap) { IPMap::iterator ii = ipmap->begin(); while (ii != ipmap->end()) { bool active = false; for (int i = 0; i < LPI_PROTO_LAST; i++) { ii->second.total_observed_period[i] = ii->second.currently_active_flows[i]; if (ii->second.total_observed_period[i] > 0) { counts[i]++; active = true; } } if (!active) { /* If there are no active flows for this IP, * remove it from the IP map to save space */ IPMap::iterator tmp = ii; ii ++; ipmap->erase(tmp); } else { ii++; } } } static int reset_user(UserCounters *user, bool wipe_all) { size_t array_size = LPI_PROTO_LAST * sizeof(uint64_t); memset(user->in_pkt_count, 0, array_size); memset(user->out_pkt_count, 0, array_size); memset(user->in_byte_count, 0, array_size); memset(user->out_byte_count, 0, array_size); memset(user->in_flow_count, 0, array_size); memset(user->out_flow_count, 0, array_size); memset(user->remote_ips, 0, array_size); /* Don't reset the current flow count unless told to! */ if (wipe_all) { memset(user->in_current_flows, 0, array_size); memset(user->out_current_flows, 0, array_size); } for (int i = 0; i < LPI_PROTO_LAST; i++) { user->in_peak_flows[i] = user->in_current_flows[i]; user->out_peak_flows[i] = user->out_current_flows[i]; } if (user->in_current_flows > 0) return 0; if (user->out_current_flows > 0) return 0; /* Tell the caller that this user is no longer active and can be * released */ return 1; } void reset_counters(LiveCounters *cnt, bool wipe_all) { UserMap::iterator it, tmp; reset_user(&cnt->all, wipe_all); it = cnt->users.begin(); while (it != cnt->users.end()) { if (reset_user(it->second, wipe_all)) { tmp = it; it ++; free(tmp->second); cnt->users.erase(tmp); } else { it ++; } } memset(cnt->all_local_ips, 0, LPI_PROTO_LAST * sizeof(uint64_t)); memset(cnt->active_local_ips, 0, LPI_PROTO_LAST * sizeof(uint64_t)); if (!wipe_all) { reset_local_ip_counts(cnt->all_local_ips, &cnt->observed_local); reset_local_ip_counts(cnt->active_local_ips, &cnt->active_local); } else { wipe_local_ip_collectors(&cnt->observed_local); wipe_local_ip_collectors(&cnt->active_local); } cnt->reports ++; } void init_live_counters(LiveCounters *cnt, bool track_users) { cnt->user_tracking = track_users; reset_counters(cnt, true); /* Force the report count to be zero, because reset_counters would * normally increment it */ cnt->reports = 0; } void init_live_flow(LiveCounters *cnt, Flow *f, uint8_t dir, double ts) { LiveFlow *live = NULL; live = (LiveFlow *)malloc(sizeof(LiveFlow)); live->init_dir = dir; live->in_wbytes = 0; live->out_wbytes = 0; live->in_pbytes = 0; live->out_pbytes = 0; live->in_pkts = 0; live->out_pkts = 0; live->start_ts = ts; live->start_period = cnt->reports; live->count_period = cnt->reports; lpi_init_data(&live->lpi); f->extension = live; live->proto = NULL; live->activated_ip = false; f->id.get_local_ip_str(live->local_ip); f->id.get_external_ip_str(live->ext_ip); if (cnt->user_tracking) { /* Create a new counter for the user if needed */ UserMap::iterator it = cnt->users.find(live->local_ip); if (it != cnt->users.end()) return; UserCounters *uc = (UserCounters *)malloc(sizeof(UserCounters)); reset_user(uc, true); cnt->users[live->local_ip] = uc; cnt->user_count ++; } } static void stdout_counter_array(double ts, const char *id, uint32_t freq, const char *type, uint64_t *counter) { int i; for (i = 0; i < LPI_PROTO_LAST; i++) { /* Ignore protocols that are deprecated in libprotoident */ if (lpi_is_protocol_inactive((lpi_protocol_t)i)) continue; fprintf(stdout, "%s,%.0f,%u,%s,%s,", id, ts, freq, type, lpi_print((lpi_protocol_t)i)); fprintf(stdout, "%" PRIu64 "\n", counter[i]); } } /* Dumps the values for all of our counters to standard output */ void dump_counters_stdout(UserCounters *cnt, double ts, char *local_id, uint32_t report_freq) { stdout_counter_array(ts, local_id, report_freq, "in_pkts", IN_PKTS); stdout_counter_array(ts, local_id, report_freq, "out_pkts", OUT_PKTS); stdout_counter_array(ts, local_id, report_freq, "in_bytes", IN_BYTES); stdout_counter_array(ts, local_id, report_freq, "out_bytes", OUT_BYTES); stdout_counter_array(ts, local_id, report_freq, "in_new_flows", IN_NEW); stdout_counter_array(ts, local_id, report_freq, "out_new_flows", OUT_NEW); stdout_counter_array(ts, local_id, report_freq, "in_peak_flows", IN_PEAK); stdout_counter_array(ts, local_id, report_freq, "out_peak_flows", OUT_PEAK); } /* Safely decrements a counter value - this way we won't reduce below zero and * succumb to integer wrapping bugs */ static inline void decrement_counter(uint64_t *array, lpi_protocol_t proto, uint32_t val) { if (array[proto] < val) { array[proto] = 0; } else { array[proto] -= val; } } /* Determines whether it is worth calling lpi_guess_protocol for a flow */ static bool should_guess(LiveFlow *live, uint32_t plen, uint8_t dir) { /* Special case to deal with possible "No Payload" flows */ if (live->out_pbytes == 0 && live->in_pbytes == 0 && live->proto == NULL) return true; /* If the current packet has no payload, then it is not going to * change anything */ if (plen == 0) return false; /* If this is the first outgoing packet with payload, check */ if (dir == 0 && live->out_pbytes == plen) return true; /* If this is the first incoming packet with payload, check */ if (dir == 1 && live->in_pbytes == plen) return true; /* This is a payload bearing packet but it isn't the first for that * direction so it isn't going to affect libprotoident at all */ return false; } static inline void activate_local_ip(LiveFlow *live, IPMap *ipmap, uint64_t *ip_counts) { /* Update the IP map for this flow */ IPCollector& ip_coll = (*ipmap)[live->local_ip]; ip_coll.currently_active_flows[PROTONUM] += 1; ip_coll.total_observed_period[PROTONUM] += 1; if (ip_coll.total_observed_period[PROTONUM] == 1) ip_counts[PROTONUM] += 1; } static inline void swap_local_ip(LiveFlow *live, IPMap *ipmap, uint64_t *ip_counts, lpi_protocol_t old) { IPMap::iterator it = ipmap->find(live->local_ip); assert(it != ipmap->end()); IPCollector &col = it->second; assert(col.currently_active_flows[old] > 0); assert(col.total_observed_period[old] > 0); col.currently_active_flows[old] -= 1; col.total_observed_period[old] -= 1; col.currently_active_flows[PROTONUM] += 1; col.total_observed_period[PROTONUM] += 1; if (col.total_observed_period[old] == 0) { ip_counts[old] -= 1; } if (col.total_observed_period[PROTONUM] == 1) { ip_counts[PROTONUM] += 1; } } static inline void deactivate_local_ip(LiveFlow *live, IPMap *ipmap) { IPMap::iterator it = ipmap->find(live->local_ip); assert(it != ipmap->end()); IPCollector &col = it->second; col.currently_active_flows[PROTONUM] -= 1; } static inline void update_unchanged(LiveFlow *live, UserCounters *cnt, uint32_t wlen, uint8_t dir) { /* The protocol classification hasn't changed, so just increment * the packet and byte counters based on the new packet */ if (dir == 0) { OUT_BYTES[PROTONUM] += wlen; OUT_PKTS[PROTONUM] += 1; } else { IN_BYTES[PROTONUM] += wlen; IN_PKTS[PROTONUM] += 1; } } static inline void update_unchanged_ip(LiveFlow *live, LiveCounters *cnt, uint32_t plen, uint8_t dir) { /* Basically, we are just checking for cases where the flow has not * seen any outgoing payload originally, but this last packet has * changed that so we need to count the local IP as active */ if (dir != 0) return; if (plen == 0) return; if (plen != live->out_pbytes) return; if (PROTONUM == LPI_PROTO_NO_PAYLOAD) assert(0); assert(live->activated_ip == false); //printf("UNCHANGED: Activating %s\n", live->local_ip, PROTONUM); activate_local_ip(live, &(cnt->active_local), cnt->active_local_ips); live->activated_ip = true; } static inline void update_new(LiveFlow *live, UserCounters *cnt) { /* This is a new flow that has been classified for the first * time. We therefore need to increase the new, current and * possibly peak flow counters for whatever protocol we belong * to */ if (live->init_dir == 0) { OUT_NEW[PROTONUM] += 1; OUT_CURR[PROTONUM] += 1; if (OUT_CURR[PROTONUM] > OUT_PEAK[PROTONUM]) OUT_PEAK[PROTONUM] = OUT_CURR[PROTONUM]; } else { IN_NEW[PROTONUM] += 1; IN_CURR[PROTONUM] += 1; if (IN_CURR[PROTONUM] > IN_PEAK[PROTONUM]) IN_PEAK[PROTONUM] = IN_CURR[PROTONUM]; } /* Also add our packet and byte counts to the appropriate counters */ OUT_BYTES[PROTONUM] += live->out_wbytes; OUT_PKTS[PROTONUM] += live->out_pkts; IN_BYTES[PROTONUM] += live->in_wbytes; IN_PKTS[PROTONUM] += live->in_pkts; } static inline void update_new_ip(LiveFlow *live, LiveCounters *cnt) { /* New flow, so increment the observed IP count */ activate_local_ip(live, &(cnt->observed_local), cnt->all_local_ips); /* If this flow has sent payload in direction 0, update the active * IP count too */ if (live->out_pbytes == 0) { return; } if (PROTONUM == LPI_PROTO_NO_PAYLOAD) assert(0); //printf("NEW: Activating %s %d\n", live->local_ip, PROTONUM); assert(live->activated_ip == false); activate_local_ip(live, &(cnt->active_local), cnt->active_local_ips); live->activated_ip = true; } static inline void update_changed(LiveFlow *live, UserCounters *cnt, uint32_t wlen, uint8_t dir, uint32_t period, lpi_protocol_t old) { /* Protocol has "changed" - subtract whatever we would have * inserted into the previous protocol counter and shift those * values into the new one */ /* If the current period is the same period as when the flow * started, we need to correct our new flow counter */ if (period == live->start_period) { if (live->init_dir == 0) { assert(OUT_NEW[old] > 0); OUT_NEW[old] --; OUT_NEW[PROTONUM] ++; } else { assert(IN_NEW[old] > 0); IN_NEW[old] --; IN_NEW[PROTONUM] ++; } } /* Update the current and peak flow counts as necessary. Peak flow * counts can end up being a bit misleading as a result - you can't * really do it live AND get complete accuracy :/ */ if (live->init_dir == 0) { assert(OUT_CURR[old] > 0); OUT_CURR[old] --; OUT_CURR[PROTONUM] ++; if (OUT_CURR[PROTONUM] > OUT_PEAK[PROTONUM]) OUT_PEAK[PROTONUM] = OUT_CURR[PROTONUM]; } else { assert(IN_CURR[old] > 0); IN_CURR[old] --; IN_CURR[PROTONUM] ++; if (IN_CURR[PROTONUM] > IN_PEAK[PROTONUM]) IN_PEAK[PROTONUM] = IN_CURR[PROTONUM]; } /* The stats in the LiveFlow include the current packet, but the * current counter values do not so we need to NOT include the current * packet when correcting the byte and packet counts */ if (dir == 0) { assert(live->out_wbytes >= wlen); assert(live->out_pkts >= 1); decrement_counter(IN_BYTES, old, live->in_wbytes); decrement_counter(IN_PKTS, old, live->in_pkts); decrement_counter(OUT_BYTES, old, live->out_wbytes - wlen); decrement_counter(OUT_PKTS, old, live->out_pkts - 1); } else { assert(live->in_wbytes >= wlen); assert(live->in_pkts >= 1); decrement_counter(OUT_BYTES, old, live->out_wbytes); decrement_counter(OUT_PKTS, old, live->out_pkts); decrement_counter(IN_BYTES, old, live->in_wbytes - wlen); decrement_counter(IN_PKTS, old, live->in_pkts - 1); } /* Right, now we can add our packets and bytes to the counter for * our new protocol */ OUT_BYTES[PROTONUM] += live->out_wbytes; OUT_PKTS[PROTONUM] += live->out_pkts; IN_BYTES[PROTONUM] += live->in_wbytes; IN_PKTS[PROTONUM] += live->in_pkts; } static void update_changed_ip(LiveFlow *live, LiveCounters *cnt, uint32_t plen, uint8_t dir, lpi_protocol_t old) { swap_local_ip(live, &cnt->observed_local, cnt->all_local_ips, old); if (live->out_pbytes == 0) return; if (PROTONUM == LPI_PROTO_NO_PAYLOAD) assert(0); if (dir == 0 && plen == live->out_pbytes) { /* The packet that triggered the change is the first * outgoing packet for this flow, so we haven't activated * the IP for this flow yet! */ //printf("SWAP: Activating %s %d\n", live->local_ip, PROTONUM); activate_local_ip(live, &(cnt->active_local), cnt->active_local_ips); return; } //printf("Swapping %s %d->%d\n", live->local_ip, old, PROTONUM); swap_local_ip(live, &cnt->active_local, cnt->active_local_ips, old); } int update_protocol_counters(LiveFlow *live, LiveCounters *cnt, uint32_t wlen, uint32_t plen, uint8_t dir) { /* Remember the old protocol before we overwrite it! */ lpi_module_t *old_proto = live->proto; /* We only want to ask lpi for the protocol if there is a chance that * the protocol may have changed. */ if (should_guess(live, plen, dir)) { live->proto = lpi_guess_protocol(&live->lpi); } if (live->proto == NULL) { fprintf(stderr, "Warning: guessed NULL protocol\n"); return -1; } if (old_proto == live->proto) { update_unchanged(live, &cnt->all, wlen, dir); if (cnt->user_tracking) { update_unchanged(live, cnt->users[live->local_ip], wlen, dir); } update_unchanged_ip(live, cnt, plen, dir); } else if (old_proto == NULL) { update_new(live, &cnt->all); if (cnt->user_tracking) { update_new(live, cnt->users[live->local_ip]); } update_new_ip(live, cnt); } else { update_changed(live, &cnt->all, wlen, dir, cnt->reports, old_proto->protocol); if (cnt->user_tracking) { update_changed(live, cnt->users[live->local_ip], wlen, dir, cnt->reports, old_proto->protocol); } update_changed_ip(live, cnt, plen, dir, old_proto->protocol); } return 0; } void update_liveflow_stats(LiveFlow *live, libtrace_packet_t *packet, LiveCounters *cnt, uint8_t dir) { /* We're in a new reporting period - reset our stats because we * only want the amount of traffic since we last reported */ if (live->count_period != cnt->reports) { live->out_wbytes = 0; live->out_pkts = 0; live->in_wbytes = 0; live->in_pkts = 0; live->count_period = cnt->reports; } assert(trace_get_payload_length(packet) <= 65536); if (dir == 0) { live->out_pbytes += trace_get_payload_length(packet); live->out_wbytes += trace_get_wire_length(packet); live->out_pkts += 1; } else { live->in_pbytes += trace_get_payload_length(packet); live->in_wbytes += trace_get_wire_length(packet); live->in_pkts += 1; } } static inline void update_counter_expired(LiveFlow *live, UserCounters *cnt) { if (live->init_dir == 0) { assert(OUT_CURR[PROTONUM] != 0); OUT_CURR[PROTONUM] --; } else { assert(IN_CURR[PROTONUM] != 0); IN_CURR[PROTONUM] --; } } static inline void update_expired_ip(LiveFlow *live, LiveCounters *cnt) { deactivate_local_ip(live, &(cnt->observed_local)); if (live->out_pbytes == 0) return; deactivate_local_ip(live, &(cnt->active_local)); } void destroy_live_flow(LiveFlow *live, LiveCounters *cnt) { /* Decrement the currently active flow counter for our matching * protocol */ update_counter_expired(live, &cnt->all); if (cnt->user_tracking) { update_counter_expired(live, cnt->users[live->local_ip]); } update_expired_ip(live, cnt); free(live); } ================================================ FILE: tools/live/live_common.h ================================================ /* * This file is part of libprotoident * * Copyright (c) 2011 The University of Waikato, Hamilton, New Zealand. * Author: Shane Alcock * * With contributions from: * Aaron Murrihy * Donald Neal * * All rights reserved. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with libprotoident; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id$ */ #ifndef LIVE_COMMON_H_ #define LIVE_COMMON_H_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; struct IPCollector { IPCollector() { memset(currently_active_flows, 0, LPI_PROTO_LAST * sizeof(uint64_t)); memset(total_observed_period, 0, LPI_PROTO_LAST * sizeof(uint64_t)); } uint64_t currently_active_flows[LPI_PROTO_LAST]; uint64_t total_observed_period[LPI_PROTO_LAST]; }; typedef map IPMap; /* This structure contains all the current values for all the statistics we * want our collector to be able to track on a per-user basis. There is an * entry in each array for each supported LPI protocol */ typedef struct user_counts { /* Incoming packets */ uint64_t in_pkt_count[LPI_PROTO_LAST]; /* Outgoing packets */ uint64_t out_pkt_count[LPI_PROTO_LAST]; /* Incoming bytes (based on wire length) */ uint64_t in_byte_count[LPI_PROTO_LAST]; /* Outgoing bytes (based on wire length) */ uint64_t out_byte_count[LPI_PROTO_LAST]; /* New flows originating from outside the local network */ uint64_t in_flow_count[LPI_PROTO_LAST]; /* New flows originating from inside the local network */ uint64_t out_flow_count[LPI_PROTO_LAST]; /* Currently active flows that originated from outside */ uint64_t in_current_flows[LPI_PROTO_LAST]; /* Currently active flows that originated from inside */ uint64_t out_current_flows[LPI_PROTO_LAST]; /* Peak values for in_current_flows since the last report */ uint64_t in_peak_flows[LPI_PROTO_LAST]; /* Peak values for out_current_flows since the last report */ uint64_t out_peak_flows[LPI_PROTO_LAST]; /* Number of remote IPs that are talking to us */ uint64_t remote_ips[LPI_PROTO_LAST]; } UserCounters; typedef map UserMap; typedef struct counters { /* The number of times that the counters have been reset, which * should correspond with the number of times we have reported * statistics (hence the name 'reports' rather than 'resets') */ uint32_t reports; uint32_t user_count; UserCounters all; UserMap users; /* These aren't useful to track on a per user basis */ IPMap active_local; IPMap observed_local; uint64_t all_local_ips[LPI_PROTO_LAST]; uint64_t active_local_ips[LPI_PROTO_LAST]; bool user_tracking; } LiveCounters; /* Structure containing all the data we want to store for each flow */ typedef struct live { /* The direction of the first packet for the flow */ uint8_t init_dir; /* The local IP, stored as a string */ char local_ip[INET6_ADDRSTRLEN]; /* The remote IP, stored as a string */ char ext_ip[INET6_ADDRSTRLEN]; /** Statistics about this flow * NOTE: byte and packet counts are not for the flow as a whole, but * instead refer to what has been seen during the current reporting * period, i.e. since the last time reset_counters() was called. */ /* Incoming packets observed for the flow */ uint64_t in_pkts; /* Outgoing packets observed for the flow */ uint64_t out_pkts; /* Incoming bytes (wire length) observed for the flow */ uint64_t in_wbytes; /* Incoming bytes (payload length) observed for the flow */ uint64_t in_pbytes; /* Outgoing bytes (wire length) observed for the flow */ uint64_t out_wbytes; /* Outgoing bytes (payload length) observed for the flow */ uint64_t out_pbytes; /* Timestamp when this flow was first observed */ double start_ts; /* The reporting period when this flow was first observed */ uint32_t start_period; /* The reporting period when this flow was last observed */ uint32_t count_period; /* LPI data structure - needed for classification */ lpi_data_t lpi; /* The protocol that this flow matches */ lpi_module_t *proto; bool activated_ip; } LiveFlow; /* Allocates and initialises a new LiveFlow structure and attaches it to the * provided Flow structure. * * When you're done with the flow, make sure to call destroy_live_flow! */ void init_live_flow(LiveCounters *cnt, Flow *f, uint8_t dir, double ts); /* Initialises a LiveCounters structure. Does not allocate memory - you should * pass in a pointer to an existing instance of LiveCounters. * * This will reset ALL the counter values and the report count to zero. */ void init_live_counters(LiveCounters *cnt, bool track_users); /* Resets the counters - if not doing cumulative stats, this should be called * after outputting the counters. * * If wipe_all is true, then the currently active flow counts will be set to * zero (probably not what you want). * If wipe_all is false, the currently active flow counts will be retained and * the peak active flow counts will be set to the currently active flow count. * * Calling this function will also increment the reports value in the * LiveCounters structure. */ void reset_counters(LiveCounters *cnt, bool wipe_all); /* Dumps the values of all the counters to standard output * ts should be set to the timestamp when the counters were last reset * local_id is a string that will identify this particular measurement process, * e.g. the source of the packets * report_freq is the number of seconds that have passed since the counters * were last reset (this will be included in the output so users can do * rate calculations). * * Counters are not reset after dumping - you need to call reset_counters() * to do that. */ void dump_counters_stdout(UserCounters *cnt, double ts, char *local_id, uint32_t report_freq); /* Updates the counters based on the most recent packet for a given flow. * If the classification for the flow has changed, the counters for the old * protocol are decreased appropriately and the flow stats are reattributed * to the new protocol. * * Workflow is important with this function - it should be called AFTER calling * both update_liveflow_stats() AND lpi_update_data(). See lpi_live.cc for a * working example. * * wlen is the wire length for the most recent packet. * plen is the payload length for the most recent packet. * dir is the direction of the most recent packet. * * Returns -1 if an error occurs, 0 if successful. */ int update_protocol_counters(LiveFlow *live, LiveCounters *cnt, uint32_t wlen, uint32_t plen, uint8_t dir); /* Cleans up a LiveFlow structure that had been created using init_live_flow(). * Also decrements the appropriate current flow counter, so you can call this * when a flow expires and ensure the counter is correct. */ void destroy_live_flow(LiveFlow *live, LiveCounters *cnt); /* Updates the statistics stored in the LiveFlow structure, based on the * provided packet. * * First, it checks if the counters have been reset since the last time the * flow was updated. If so, the stats are reset to zero (the stats only refer * to the current reporting period). * * After that, the byte and packet counts are incremented accordingly. */ void update_liveflow_stats(LiveFlow *live, libtrace_packet_t *packet, LiveCounters *cnt, uint8_t dir); #endif ================================================ FILE: tools/live/lpi_live.cc ================================================ /* * This file is part of libprotoident * * Copyright (c) 2011 The University of Waikato, Hamilton, New Zealand. * Author: Shane Alcock * * With contributions from: * Aaron Murrihy * Donald Neal * * All rights reserved. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with libprotoident; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id$ */ #define __STDC_FORMAT_MACROS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../tools_common.h" #include "live_common.h" enum { DIR_METHOD_TRACE, DIR_METHOD_MAC, DIR_METHOD_PORT }; int dir_method = DIR_METHOD_PORT; char *local_mac = NULL; uint8_t mac_bytes[6]; static volatile int done = 0; uint32_t report_freq = 60; char local_id[256]; bool output_rrd = false; LiveCounters counts; void dump_rrd_counters(double ts) { int i; for (i = 0; i < LPI_PROTO_LAST; i++) { if (lpi_is_protocol_inactive((lpi_protocol_t)i)) continue; fprintf(stdout, "%s %s %u:", local_id, lpi_print((lpi_protocol_t)i), (uint32_t)ts); fprintf(stdout, "%" PRIu64 ":", counts.all.in_pkt_count[i]); fprintf(stdout, "%" PRIu64 ":", counts.all.out_pkt_count[i]); fprintf(stdout, "%" PRIu64 ":", counts.all.in_byte_count[i]); fprintf(stdout, "%" PRIu64 ":", counts.all.out_byte_count[i]); fprintf(stdout, "%" PRIu64 ":", counts.all.in_flow_count[i]); fprintf(stdout, "%" PRIu64 ":", counts.all.out_flow_count[i]); fprintf(stdout, "%" PRIu64 ":", counts.all.in_current_flows[i]); fprintf(stdout, "%" PRIu64 "\n", counts.all.out_current_flows[i]); } } /* Expires all flows that libflowmanager believes have been idle for too * long. The exp_flag variable tells libflowmanager whether it should force * expiry of all flows (e.g. if you have reached the end of the program and * want the stats for all the still-active flows). Otherwise, only flows * that have been idle for longer than their expiry timeout will be expired. */ void expire_live_flows(double ts, bool exp_flag) { Flow *expired; /* Loop until libflowmanager has no more expired flows available */ while ((expired = lfm_expire_next_flow(ts, exp_flag)) != NULL) { LiveFlow *live = (LiveFlow *)expired->extension; destroy_live_flow(live, &counts); /* VERY IMPORTANT: delete the Flow structure itself, even * though we did not directly allocate the memory ourselves */ lfm_release_flow(expired); } } void per_packet(libtrace_packet_t *packet) { Flow *f; LiveFlow *live = NULL; uint8_t dir; bool is_new = false; libtrace_tcp_t *tcp = NULL; void *l3; double ts; uint16_t l3_type = 0; l3 = trace_get_layer3(packet, &l3_type, NULL); if (l3_type != TRACE_ETHERTYPE_IP && l3_type != TRACE_ETHERTYPE_IPV6) return; if (l3 == NULL) return; /* Expire all suitably idle flows */ ts = trace_get_seconds(packet); expire_live_flows(ts, false); /* Determine packet direction */ if (dir_method == DIR_METHOD_TRACE) { dir = trace_get_direction(packet); } if (dir_method == DIR_METHOD_MAC) { dir = mac_get_direction(packet, mac_bytes); } if (dir_method == DIR_METHOD_PORT) { dir = port_get_direction(packet); } if (dir != 0 && dir != 1) return; /* Match the packet to a Flow - this will create a new flow if * there is no matching flow already in the Flow map and set the * is_new flag to true. */ f = lfm_match_packet_to_flow(packet, dir, &is_new); /* Libflowmanager did not like something about that packet - best to * just ignore it and carry on */ if (f == NULL) { return; } tcp = trace_get_tcp(packet); /* If the returned flow is new, you will probably want to allocate and * initialise any custom data that you intend to track for the flow */ if (is_new) { init_live_flow(&counts, f, dir, ts); live = (LiveFlow *)f->extension; } else { live = (LiveFlow *)f->extension; //if (tcp && tcp->syn && !tcp->ack) // live->init_dir = dir; } update_liveflow_stats(live, packet, &counts, dir); /* Pass the packet into libprotolive so that it can extract any * info it needs from this packet */ lpi_update_data(packet, &live->lpi, dir); if (update_protocol_counters(live, &counts, trace_get_wire_length(packet), trace_get_payload_length(packet), dir) == -1) { trace_dump_packet(packet); //dump_live_flow(live); } /* Update TCP state for TCP flows. The TCP state determines how long * the flow can be idle before being expired by libflowmanager. For * instance, flows for which we have only seen a SYN will expire much * quicker than a TCP connection that has completed the handshake */ if (tcp) { lfm_check_tcp_flags(f, tcp, dir, ts); } /* Tell libflowmanager to update the expiry time for this flow */ lfm_update_flow_expiry_timeout(f, ts); } static void cleanup_signal(int sig) { (void)sig; done=1; } static void usage(char *prog) { printf("Usage details for %s\n\n", prog); printf("%s [-i ] [-m ] [-l ] [-r] [-R] [-H] inputURI [inputURI ...]\n\n", prog); printf("Options:\n"); printf(" -l Determine direction based on representing the 'inside' \n portion of the network\n"); printf(" -m Id number to use for this monitor (defaults to $HOSTNAME)\n"); printf(" -T Use trace direction tags to determine direction\n"); printf(" -f Ignore flows that do not match the given BPF filter\n"); printf(" -R Ignore flows involving private RFC 1918 address space\n"); printf(" -i Report statistics every seconds\n"); printf(" -r Output results in a format that can be easily used to update an RRD\n"); exit(0); } int main(int argc, char *argv[]) { libtrace_t *trace; libtrace_packet_t *packet; libtrace_filter_t *filter = NULL; struct sigaction sigact; bool opt_true = true; bool opt_false = false; int i, opt; double ts; char *filterstring = NULL; int dir; bool ignore_rfc1918 = false; double next_report = 0.0; uint32_t max_reports = 0; uint32_t reports_done = 0; if (gethostname(local_id, 256) == -1) { strncpy(local_id, "unknown", 256); } packet = trace_create_packet(); if (packet == NULL) { perror("Creating libtrace packet"); return -1; } while ((opt = getopt(argc, argv, "ri:f:Rhl:Tm:")) != EOF) { switch (opt) { case 'l': local_mac = optarg; dir_method = DIR_METHOD_MAC; break; case 'T': dir_method = DIR_METHOD_TRACE; break; case 'f': filterstring = optarg; break; case 'r': output_rrd = true; break; case 'R': ignore_rfc1918 = true; break; case 'i': report_freq = atoi(optarg); break; case 'm': strncpy(local_id, optarg, 256); break; case 'h': default: usage(argv[0]); } } if (filterstring != NULL) { filter = trace_create_filter(filterstring); } if (local_mac != NULL) { if (convert_mac_string(local_mac, mac_bytes) < 0) { fprintf(stderr, "Invalid MAC: %s\n", local_mac); return 1; } } /* This tells libflowmanager to ignore any flows where an RFC1918 * private IP address is involved */ if (lfm_set_config_option(LFM_CONFIG_IGNORE_RFC1918, &ignore_rfc1918) == 0) return -1; /* This tells libflowmanager not to replicate the TCP timewait * behaviour where closed TCP connections are retained in the Flow * map for an extra 2 minutes */ if (lfm_set_config_option(LFM_CONFIG_TCP_TIMEWAIT, &opt_false) == 0) return -1; /* This tells libflowmanager not to utilise the fast expiry rules for * short-lived UDP connections - these rules are experimental * behaviour not in line with recommended "best" practice */ if (lfm_set_config_option(LFM_CONFIG_SHORT_UDP, &opt_false) == 0) return -1; sigact.sa_handler = cleanup_signal; sigemptyset(&sigact.sa_mask); sigact.sa_flags = SA_RESTART; sigaction(SIGINT, &sigact, NULL); sigaction(SIGTERM, &sigact, NULL); signal(SIGINT,&cleanup_signal); signal(SIGTERM,&cleanup_signal); if (lpi_init_library() == -1) return -1; init_live_counters(&counts, false); if (optind == argc) { fprintf(stderr, "No input sources specified!\n"); usage(argv[0]); } for (i = optind; i < argc; i++) { fprintf(stderr, "%s\n", argv[i]); /* Bog-standard libtrace stuff for reading trace files */ trace = trace_create(argv[i]); if (!trace) { perror("Creating libtrace trace"); return -1; } if (trace_is_err(trace)) { trace_perror(trace, "Opening trace file"); trace_destroy(trace); continue; } if (filter && trace_config(trace, TRACE_OPTION_FILTER, filter) == -1) { trace_perror(trace, "Configuring filter"); trace_destroy(trace); return -1; } if (trace_start(trace) == -1) { trace_perror(trace, "Starting trace"); trace_destroy(trace); continue; } while (trace_read_packet(trace, packet) > 0) { ts = trace_get_seconds(packet); per_packet(packet); if (next_report == 0.0 && ts != 0.0) { next_report = ts + report_freq; } while (ts > next_report) { if (output_rrd) { dump_rrd_counters(next_report - report_freq); } else { dump_counters_stdout(&counts.all, next_report - report_freq, local_id, report_freq); } reset_counters(&counts, false); next_report += report_freq; reports_done ++; if (max_reports != 0 && reports_done >= max_reports) done = 1; } if (done) break; } if (done) { trace_destroy(trace); break; } if (trace_is_err(trace)) { trace_perror(trace, "Reading packets"); trace_destroy(trace); continue; } trace_destroy(trace); } reset_counters(&counts, false); trace_destroy_packet(packet); expire_live_flows(ts, true); lpi_free_library(); return 0; } ================================================ FILE: tools/live/lpicp.cc ================================================ #include #include "lpicp.h" /* Handy 32 bit byteswapping function - borrowed from libtrace */ static inline uint32_t byteswap32(uint32_t num) { return ((num&0x000000FFU)<<24) | ((num&0x0000FF00U)<<8) | ((num&0x00FF0000U)>>8) | ((num&0xFF000000U)>>24); } /* Even handier 64 bit byte swapping function */ static inline uint64_t byteswap64(uint64_t num) { return (byteswap32((num&0xFFFFFFFF00000000ULL)>>32)) |((uint64_t)byteswap32(num&0x00000000FFFFFFFFULL)<<32); } #ifndef __BYTE_ORDER #warning "Byte order is not defined" #endif uint64_t ntoh64(uint64_t num) { #if __BYTE_ORDER == __BIG_ENDIAN return num; #else return byteswap64(num); #endif } uint64_t hton64(uint64_t num) { #if __BYTE_ORDER == __BIG_ENDIAN return num; #else return byteswap64(num); #endif } ================================================ FILE: tools/live/lpicp.h ================================================ #ifndef LPICP_H #define LPICP_H #include enum lpicp_record { LPICP_STATS, LPICP_ONGOING, LPICP_EXPIRED }; enum lpicp_metric { LPICP_METRIC_PKTS, LPICP_METRIC_BYTES, LPICP_METRIC_NEW_FLOWS, LPICP_METRIC_CURR_FLOWS, LPICP_METRIC_PEAK_FLOWS, LPICP_METRIC_ACTIVE_IPS }; /* Structure which defines a custom header used at the start of a packet which * contains flow records that are to be exported over a network. * It contains the information that is common for all the flows. */ typedef struct __attribute__((packed)) lpicp_header { uint8_t version; uint8_t record_type; uint16_t total_len; uint16_t name_len; uint16_t reserved; } Lpicp_header_t ; /* Structure which defines a stat header used for LPICP_STATS records */ typedef struct __attribute__((packed)) lpicp_stat_header { uint32_t secs; uint32_t usecs; uint32_t freq; uint8_t dir; uint8_t metric; uint16_t num_records; } Lpicp_stat_header_t; /* Function to convert a uint64_t to Host Byte Order from Network Byte Order */ uint64_t ntoh64(uint64_t num); /* Function to convert a uint64_t to Network Byte Order from Host Byte Order */ uint64_t hton64(uint64_t num); #endif ================================================ FILE: tools/live/lpicp_export.cc ================================================ #define __STDC_FORMAT_MACROS #include #include #include #include #include #include "lpicp.h" #include "live_common.h" Lpi_collect_buffer_t buffer; Lpicp_header_t *tmp_hdr; void lpi_create_header (char *local_id ) { /* Casting the buffer struct as a Lpicp_header_t and filling in the available * values*/ tmp_hdr = (Lpicp_header_t *)&(buffer.buf[buffer.buf_used]); tmp_hdr->version = 1; tmp_hdr->record_type = LPICP_STATS; /* Restricting local_id to 100 characters */ if ( strlen(local_id) > 100) { char tmp[100]; strncpy(tmp, local_id, 100); local_id = tmp; } tmp_hdr->name_len = ntohs((uint16_t)strlen(local_id)); tmp_hdr->reserved = 0; /* Incrementing buf_used with the size of the struct Lpicp_header_t, which * is 8bytes */ buffer.buf_used = sizeof(tmp_hdr); } void lpi_add_localId (char *local_id ) { /* Copy the local_id into the buffer and increment buffer.buf_used */ char* s = strcpy(&buffer.buf[buffer.buf_used], local_id); buffer.buf_used += strlen(local_id); } void lpi_add_subheader (struct timeval tv, uint32_t report_len, uint8_t dir, uint8_t metric) { /* Casting the buffer struct as a Lpicp_stat_header_t and filling in the available * values*/ Lpicp_stat_header_t *tmp_stat_hdr = (Lpicp_stat_header_t *)&(buffer.buf[buffer.buf_used]); tmp_stat_hdr->secs = ntohl(tv.tv_sec); tmp_stat_hdr->usecs = ntohl(tv.tv_usec); tmp_stat_hdr->freq = ntohl(report_len); tmp_stat_hdr->dir = dir; tmp_stat_hdr->metric = metric; /* Incrementing buf_used with the size of the struct Lpicp_stat_header_t, * which is 8bytes */ buffer.buf_used += sizeof(Lpicp_stat_header_t); } /*0 if you have to stop and start a new record 1 if you managed to fit the current protocol in */ int lpi_print_proto_values(int index, uint64_t* array) { /* Check that the total size of the bytes to be added for a particular * protocol(protocol name length, protocol name, value) won't exceed the * total number of bytes in buffer.buf */ if ((1 + (strlen(lpi_print((lpi_protocol_t) index))) + sizeof(uint64_t)) > (sizeof(buffer.buf) - buffer.buf_used)) { return 0; } else { /* Adding length of the protocol name to the buffer */ int len = (strlen(lpi_print((lpi_protocol_t) index))); uint8_t temp_len = len; uint8_t *proto_len = (uint8_t *)&(buffer.buf[buffer.buf_used]); *proto_len = temp_len; buffer.buf_used++; /* Adding the protocol name */ char* s = strcpy(&buffer.buf[buffer.buf_used], lpi_print((lpi_protocol_t) index)); buffer.buf_used += len; /* Adding the value */ uint64_t *value = (uint64_t *)&(buffer.buf[buffer.buf_used]); *value = hton64(array[index]); buffer.buf_used += sizeof(uint64_t); return 1; } } void lpi_export_single_counter (uint64_t* array, struct timeval tv, uint8_t dir, uint8_t metric, char* local_id, uint32_t report_len) { uint32_t current_proto_id = 0; while (current_proto_id != LPI_PROTO_LAST ) { /* Resetting the buffer */ buffer.buf_used = 0; buffer.buf_exported = 0; /* Resetting the number of records exported in this packet */ /* Set the number of exported records */ int i = sizeof(Lpicp_header_t) + strlen(local_id); Lpicp_stat_header_t *tmp_stat_hdr = (Lpicp_stat_header_t *)&(buffer.buf[i]); tmp_stat_hdr->num_records = ntohs(0); int num_rec = 0; /* Adding the header, local_id and subheader to the buffer */ lpi_create_header(local_id); lpi_add_localId(local_id); lpi_add_subheader(tv, report_len, dir, metric); for (current_proto_id; current_proto_id < LPI_PROTO_LAST; current_proto_id++) { int ret = lpi_print_proto_values(current_proto_id, array); if (ret == 0) break; else num_rec++; } /* Set the total length of the packet */ tmp_hdr->total_len = ntohs(buffer.buf_used); /* Set the number of records exported in this flow */ tmp_stat_hdr->num_records = ntohs(num_rec); write_buffer_network(&buffer); } } void lpicp_export_counters(LiveCounters *count, struct timeval tv, char *local_id, uint32_t report_len) { /* Exporting incoming packet counts */ lpi_export_single_counter( count->in_pkt_count, tv, 1, LPICP_METRIC_PKTS, local_id, report_len); /* Outgoing packets */ lpi_export_single_counter( count->out_pkt_count, tv, 0, LPICP_METRIC_PKTS, local_id, report_len); /* Incoming bytes (based on wire length) */ lpi_export_single_counter( count->in_byte_count, tv, 1, LPICP_METRIC_BYTES, local_id, report_len); /* Outgoing bytes (based on wire length) */ lpi_export_single_counter( count->out_byte_count, tv, 0, LPICP_METRIC_BYTES, local_id, report_len); /* New flows originating from outside the local network */ lpi_export_single_counter( count->in_flow_count, tv, 1, LPICP_METRIC_NEW_FLOWS, local_id, report_len); /* New flows originating from inside the local network */ lpi_export_single_counter( count->out_flow_count, tv, 0, LPICP_METRIC_NEW_FLOWS, local_id, report_len); /* Peak values for in_current_flows since the last report */ lpi_export_single_counter( count->in_peak_flows, tv, 1, LPICP_METRIC_PEAK_FLOWS, local_id, report_len); /* Peak values for out_current_flows since the last report */ lpi_export_single_counter( count->out_peak_flows, tv, 0, LPICP_METRIC_PEAK_FLOWS, local_id, report_len); /* Number of local IPs observed using each protocol */ lpi_export_single_counter( count->local_ips, tv, 1, LPICP_METRIC_ACTIVE_IPS, local_id, report_len); } ================================================ FILE: tools/live/lpicp_export.h ================================================ #ifndef LPICP_EXPORT_H #define LPICP_EXPORT_H #include "lpicp.h" #include "live_common.h" /* * Exports all counters defined in the struct LiveCounters. * * cnt is the struct which contains all the arrays with the protocol values. * tv is the timestamp when the counters were last reset. * local_id is a string that will identify this particular measurement process, * e.g. the source of the packets * report_len is the number of seconds that have passed since the counters * were last reset (this will be included in the output so users can do * rate calculations). */ void lpicp_export_counters(LiveCounters *cnt, struct timeval tv, char *local_id, uint32_t report_len); /* Exports a single counter over the network by adding data(protocol length, * name, and value) to the buffer for each of the protocols supported by Libprotoident. * * array is the array of counters that needs to be exported, e.g. in_pkt_count[]. * tv is the timestamp when the counters were last reset. * dir is the direction of the most recent packet. * metric ?? * local_id is a string that will identify this particular measurement process, * e.g. the source of the packets * report_len is the number of seconds that have passed since the counters * were last reset (this will be included in the output so users can do * rate calculations). */ void lpi_export_single_counter (uint64_t * array, struct timeval tv, uint8_t dir, uint8_t metric, char* local_id, uint32_t report_len); /* Creates a header for the custom buffer which will contain flow records. * This header contains the information that is common for all flows. * * local_id is a string that will identify this particular measurement process, * e.g. the source of the packets */ void lpi_create_header (char *local_id ); /* Adds the local_id after the header has been added to the buffer. * * local_id is a string that will identify this particular measurement process, * e.g. the source of the packets */ void lpi_add_localId (char *local_id ); /* Adds the subheader to the buffer after the header and local_id have been added. * * tv is the timestamp when the counters were last reset. * report_len is the number of seconds that have passed since the counters * were last reset (this will be included in the output so users can do * rate calculations). * dir is the direction of the most recent packet. * metric ?? */ void lpi_add_subheader (struct timeval tv, uint32_t report_len, uint8_t dir, uint8_t metric); /* Appends the protocol details(protocol name length, name and value) from the * array in the arguments to the buffer which is to be exported over the network. * * index is the index of the protocol which is used to retrieve the protocol length, * name and value from the array. * array is the array of counters that needs to be exported, e.g. in_pkt_count[]. * * Returns 0 if the entry for a protocol would overflow the buffer, or else 1. */ int lpi_print_proto_values(int index, uint64_t* array); #endif ================================================ FILE: tools/protoident/Makefile.am ================================================ bin_PROGRAMS=lpi_protoident man_MANS = lpi_protoident.1 EXTRA_DIST = $(man_MANS) include ../Makefile.tools lpi_protoident_SOURCES=lpi_protoident.cc ../tools_common.cc lpi_protoident_LDADD = @ADD_LIBS@ -lprotoident ================================================ FILE: tools/protoident/lpi_protoident.1 ================================================ .TH LPI_PROTOIDENT "1" "April 2019" "libprotoident" "User Commands" .SH NAME lpi_protoident \- list the application protocol of all network flows in a trace .SH SYNOPSIS .B lpi_protoident inputuri .SH DESCRIPTION This tool attempts to identify each individual flow within the provided network packet trace, along with the application protocol that is being used by it, using the libprotoident traffic classification library. Identification only occurs when the flow has concluded or expired due to inactivity, so it is not very effective for real-time use cases. .PP The \fBinputuri\fR argument must be a valid libtrace URI. .SH OUTPUT FORMAT For each flow discovered in the input trace, a single line is printed to stdout describing the flow. The line contains the following whitespace separated field (in order): .nf * Application protocol (as reported by libprotoident) * IP address of the first endpoint * IP address of the second endpoint * Port used by the first endpoint * Port used by the second endpoint * Transport protocol (6 = TCP, 17 = UDP) * Unix timestamp when the flow began * Unix timestamp when the flow ended * Total bytes sent from first endpoint to second endpoint * Total bytes sent from second endpoint to first endpoint * First four bytes of payload sent from first endpoint (in hex) * First four bytes of payload sent from first endpoint (ASCII) * Size of first payload-bearing packet sent from first endpoint * First four bytes of payload sent from second endpoint (in hex) * First four bytes of payload sent from second endpoint (ASCII) * Size of first payload-bearing packet sent from second endpoint .fi .SH LINKS More details about libprotoident, the protocols it supports and how it works can be found at https://github.com/wanduow/libprotoident/wiki .SH SEE ALSO lpi_arff(1), lpi_find_unknown(1) .SH AUTHORS Shane Alcock ================================================ FILE: tools/protoident/lpi_protoident.cc ================================================ /* * This file is part of libprotoident * * Copyright (c) 2011-2015 The University of Waikato, Hamilton, New Zealand. * Author: Shane Alcock * * With contributions from: * Aaron Murrihy * Donald Neal * * All rights reserved. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with libprotoident; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id$ */ #define __STDC_FORMAT_MACROS #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../tools_common.h" enum { DIR_METHOD_TRACE, DIR_METHOD_MAC, DIR_METHOD_PORT }; libtrace_t *currenttrace; static volatile int done = 0; struct globalopts { int dir_method; bool only_dir0 ; bool only_dir1 ; bool require_both ; bool nat_hole ; bool ignore_rfc1918 ; char *local_mac ; uint8_t mac_bytes[6]; }; struct threadlocal { FlowManager *flowmanager; }; /* This data structure is used to demonstrate how to use the 'extension' * pointer to store custom data for a flow */ typedef struct ident { uint8_t init_dir; uint64_t in_bytes; uint64_t out_bytes; uint64_t in_pkts; uint64_t out_pkts; double start_ts; double end_ts; lpi_data_t lpi; } IdentFlow; static void *start_processing(libtrace_t *trace, libtrace_thread_t *thread, void *global) { bool opt_false = false; struct globalopts *opts = (struct globalopts *)global; struct threadlocal *tl = (struct threadlocal *)malloc(sizeof( struct threadlocal)); tl->flowmanager = new FlowManager(); /* This tells libflowmanager to ignore any flows where an RFC1918 * private IP address is involved */ if (tl->flowmanager->setConfigOption(LFM_CONFIG_IGNORE_RFC1918, &(opts->ignore_rfc1918)) == 0) { fprintf(stderr, "Failed to set IGNORE RFC 1918 option in libflowmanager\n"); } /* This tells libflowmanager not to replicate the TCP timewait * behaviour where closed TCP connections are retained in the Flow * map for an extra 2 minutes */ if (tl->flowmanager->setConfigOption(LFM_CONFIG_TCP_TIMEWAIT, &opt_false) == 0) { fprintf(stderr, "Failed to set TCP TIMEWAIT option in libflowmanager\n"); } /* This tells libflowmanager not to utilise the fast expiry rules for * short-lived UDP connections - these rules are experimental * behaviour not in line with recommended "best" practice */ if (tl->flowmanager->setConfigOption(LFM_CONFIG_SHORT_UDP, &opt_false) == 0) { fprintf(stderr, "Failed to set SHORT UDP option in libflowmanager\n"); } return tl; } static void *start_reporter(libtrace_t *trace, libtrace_thread_t *thread, void *global) { return NULL; } static void stop_reporter(libtrace_t *trace, libtrace_thread_t *thread, void *global, void *tls) { if (tls) free(tls); } /* Initialises the custom data for the given flow. Allocates memory for a * IdentFlow structure and ensures that the extension pointer points at * it. */ void init_ident_flow(Flow *f, uint8_t dir, double ts) { IdentFlow *ident = NULL; ident = (IdentFlow *)malloc(sizeof(IdentFlow)); ident->init_dir = dir; ident->in_bytes = 0; ident->out_bytes = 0; ident->in_pkts = 0; ident->out_pkts = 0; ident->start_ts = ts; ident->end_ts = ts; lpi_init_data(&ident->lpi); f->extension = ident; } void dump_payload(lpi_data_t lpi, uint8_t dir, char *space, int spacelen) { int i; uint8_t *pl = (uint8_t *)(&(lpi.payload[dir])); char ascii[4][5]; for (i = 0; i < 4; i++) { if (*pl > 32 && *pl < 126) { snprintf(ascii[i], 5, "%c", *pl); } else { snprintf(ascii[i], 5, "."); } pl ++; } snprintf(space, spacelen - 1, "%08x %s%s%s%s %u", ntohl(lpi.payload[dir]), ascii[0], ascii[1], ascii[2], ascii[3], lpi.payload_len[dir]); } char *display_ident(Flow *f, IdentFlow *ident, struct globalopts *opts) { char s_ip[100]; char c_ip[100]; char pload_out[100]; char pload_in[100]; char *str; lpi_module_t *proto; if (opts->only_dir0 && ident->init_dir == 1) return NULL; if (opts->only_dir1 && ident->init_dir == 0) return NULL; if (opts->require_both) { if (ident->lpi.payload_len[0] == 0 || ident->lpi.payload_len[1] == 0) { return NULL; } } if (opts->nat_hole) { if (ident->init_dir != 1) return NULL; if (ident->lpi.payload_len[0] == 0 && ident->in_pkts <= 3) return NULL; } proto = lpi_guess_protocol(&ident->lpi); f->id.get_server_ip_str(s_ip); f->id.get_client_ip_str(c_ip); dump_payload(ident->lpi, 0, pload_out, 100); dump_payload(ident->lpi, 1, pload_in, 100); str = (char *)malloc(750); snprintf(str, 750, "%s %s %s %u %u %u %.3f %.3f %" PRIu64 " %" PRIu64 " %s %s\n", proto->name, s_ip, c_ip, f->id.get_server_port(), f->id.get_client_port(), f->id.get_protocol(), ident->start_ts, ident->end_ts, ident->out_bytes, ident->in_bytes, pload_out, pload_in); return str; } /* Expires all flows that libflowmanager believes have been idle for too * long. The exp_flag variable tells libflowmanager whether it should force * expiry of all flows (e.g. if you have reached the end of the program and * want the stats for all the still-active flows). Otherwise, only flows * that have been idle for longer than their expiry timeout will be expired. */ void expire_ident_flows(libtrace_t *trace, libtrace_thread_t *thread, struct globalopts *opts, FlowManager *fm, double ts, bool exp_flag) { Flow *expired; char *result = NULL; libtrace_generic_t gen; /* Loop until libflowmanager has no more expired flows available */ while ((expired = fm->expireNextFlow(ts, exp_flag)) != NULL) { IdentFlow *ident = (IdentFlow *)expired->extension; result = display_ident(expired, ident, opts); if (result) { gen.ptr = result; trace_publish_result(trace, thread, ident->end_ts, gen, RESULT_USER); } /* Don't forget to free our custom data structure */ free(ident); fm->releaseFlow(expired); } } static void stop_processing(libtrace_t *trace, libtrace_thread_t *thread, void *global, void *tls) { struct globalopts *opts = (struct globalopts *)global; struct threadlocal *tl = (struct threadlocal *)tls; expire_ident_flows(trace, thread, opts, tl->flowmanager, 0, true); delete(tl->flowmanager); free(tl); } static void per_result(libtrace_t *trace, libtrace_thread_t *sender, void *global, void *tls, libtrace_result_t *result) { char *resultstr; if (result->type != RESULT_USER) return; resultstr = (char *)result->value.ptr; printf("%s", resultstr); free(resultstr); } static libtrace_packet_t *per_packet(libtrace_t *trace, libtrace_thread_t *thread, void *global, void *tls, libtrace_packet_t *packet) { Flow *f; IdentFlow *ident = NULL; uint8_t dir = 255; bool is_new = false; libtrace_tcp_t *tcp = NULL; void *l3; double ts; uint16_t l3_type = 0; struct globalopts *opts = (struct globalopts *)global; struct threadlocal *tl = (struct threadlocal *)tls; /* Libflowmanager only deals with IP traffic, so ignore anything * that does not have an IP header */ l3 = trace_get_layer3(packet, &l3_type, NULL); if (l3_type != TRACE_ETHERTYPE_IP && l3_type != TRACE_ETHERTYPE_IPV6) return packet; if (l3 == NULL) return packet; /* Expire all suitably idle flows */ ts = trace_get_seconds(packet); expire_ident_flows(trace, thread, opts, tl->flowmanager, ts, false); /* Determine packet direction */ if (opts->dir_method == DIR_METHOD_TRACE) { dir = trace_get_direction(packet); } if (opts->dir_method == DIR_METHOD_MAC) { dir = mac_get_direction(packet, opts->mac_bytes); } if (opts->dir_method == DIR_METHOD_PORT) { dir = port_get_direction(packet); } if (dir != 0 && dir != 1) return packet; /* Match the packet to a Flow - this will create a new flow if * there is no matching flow already in the Flow map and set the * is_new flag to true. */ f = tl->flowmanager->matchPacketToFlow(packet, dir, &is_new); /* Libflowmanager did not like something about that packet - best to * just ignore it and carry on */ if (f == NULL) { return packet; } tcp = trace_get_tcp(packet); /* If the returned flow is new, you will probably want to allocate and * initialise any custom data that you intend to track for the flow */ if (is_new) { init_ident_flow(f, dir, ts); ident = (IdentFlow *)f->extension; } else { ident = (IdentFlow *)f->extension; if (tcp && tcp->syn && !tcp->ack) ident->init_dir = dir; if (ident->end_ts < ts) ident->end_ts = ts; } /* Update our own byte and packet counters for reporting purposes */ if (dir == 0) { ident->out_pkts += 1; ident->out_bytes += trace_get_payload_length(packet); } else { ident->in_bytes += trace_get_payload_length(packet); ident->in_pkts += 1; } /* Pass the packet into libprotoident so it can extract any info * it needs from this packet */ lpi_update_data(packet, &ident->lpi, dir); assert(f); /* Tell libflowmanager to update the expiry time for this flow */ tl->flowmanager->updateFlowExpiry(f, packet, dir, ts); return packet; } static void cleanup_signal(int sig) { (void)sig; if (!done) { trace_pstop(currenttrace); done = 1; } } static void usage(char *prog) { printf("Usage details for %s\n\n", prog); printf("%s [-l ] [-T] [-b] [-d ] [-f ] [-R] [-H] [-t ] [-B buflen] inputURI [inputURI ...]\n\n", prog); printf("Options:\n"); printf(" -l Determine direction based on representing the 'inside' \n portion of the network\n"); printf(" -T Use trace direction tags to determine direction\n"); printf(" -b Ignore flows that do not send data in both directions \n"); printf(" -d Ignore flows where the initial packet does not match the given \n direction\n"); printf(" -f Ignore flows that do not match the given BPF filter\n"); printf(" -R Ignore flows involving private RFC 1918 address space\n"); printf(" -H Ignore flows that do not meet the criteria for an SPNAT hole\n"); printf(" -t Share the workload over the given number of threads\n"); printf(" -B Buffer results until there are results waiting\n"); exit(0); } int main(int argc, char *argv[]) { libtrace_filter_t *filter = NULL; struct sigaction sigact; struct globalopts opts; int i, opt; char *filterstring = NULL; int dir; int threads = 1; int bufferresults = 10; libtrace_callback_set_t *processing, *reporter; opts.dir_method = DIR_METHOD_PORT; opts.only_dir0 = false; opts.only_dir1 = false; opts.require_both = false; opts.nat_hole = false; opts.ignore_rfc1918 = false; opts.local_mac = NULL; processing = trace_create_callback_set(); trace_set_starting_cb(processing, start_processing); trace_set_stopping_cb(processing, stop_processing); trace_set_packet_cb(processing, per_packet); reporter = trace_create_callback_set(); trace_set_starting_cb(reporter, start_reporter); trace_set_stopping_cb(reporter, stop_reporter); trace_set_result_cb(reporter, per_result); while ((opt = getopt(argc, argv, "l:bB:Hd:f:RhTt:")) != EOF) { switch (opt) { case 'l': opts.local_mac = optarg; opts.dir_method = DIR_METHOD_MAC; break; case 'b': opts.require_both = true; break; case 'B': bufferresults = atoi(optarg); if (bufferresults <= 0) bufferresults = 1; break; case 'd': dir = atoi(optarg); if (dir == 0) opts.only_dir0 = true; if (dir == 1) opts.only_dir1 = true; break; case 'f': filterstring = optarg; break; case 'R': opts.ignore_rfc1918 = true; break; case 'H': opts.nat_hole = true; break; case 'T': opts.dir_method = DIR_METHOD_TRACE; break; case 't': threads = atoi(optarg); if (threads <= 0) threads = 1; break; case 'h': default: usage(argv[0]); } } if (filterstring != NULL) { filter = trace_create_filter(filterstring); } if (opts.local_mac != NULL) { if (convert_mac_string(opts.local_mac, opts.mac_bytes) < 0) { fprintf(stderr, "Invalid MAC: %s\n", opts.local_mac); return 1; } } sigact.sa_handler = cleanup_signal; sigemptyset(&sigact.sa_mask); sigact.sa_flags = SA_RESTART; sigaction(SIGINT, &sigact, NULL); sigaction(SIGTERM, &sigact, NULL); signal(SIGINT,&cleanup_signal); signal(SIGTERM,&cleanup_signal); if (lpi_init_library() == -1) return -1; for (i = optind; i < argc; i++) { if (done) break; fprintf(stderr, "%s\n", argv[i]); /* Bog-standard libtrace stuff for reading trace files */ currenttrace = trace_create(argv[i]); if (!currenttrace) { perror("Creating libtrace trace"); return -1; } if (trace_is_err(currenttrace)) { trace_perror(currenttrace, "Opening trace file"); trace_destroy(currenttrace); continue; } if (filter && trace_config(currenttrace, TRACE_OPTION_FILTER, filter) == -1) { trace_perror(currenttrace, "Configuring filter"); trace_destroy(currenttrace); return -1; } trace_set_perpkt_threads(currenttrace, threads); trace_set_reporter_thold(currenttrace, bufferresults); trace_set_combiner(currenttrace, &combiner_unordered, (libtrace_generic_t){0}); trace_set_hasher(currenttrace, HASHER_BIDIRECTIONAL, NULL, NULL); if (trace_pstart(currenttrace, &opts, processing, reporter) == -1) { trace_perror(currenttrace, "Starting trace"); trace_destroy(currenttrace); continue; } trace_join(currenttrace); trace_destroy(currenttrace); } trace_destroy_callback_set(processing); trace_destroy_callback_set(reporter); lpi_free_library(); return 0; } ================================================ FILE: tools/tools_common.cc ================================================ /* * This file is part of libprotoident * * Copyright (c) 2011 The University of Waikato, Hamilton, New Zealand. * Author: Shane Alcock * * With contributions from: * Aaron Murrihy * Donald Neal * * All rights reserved. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with libprotoident; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id$ */ #include #include #include #include "tools_common.h" int convert_mac_string(char *string, uint8_t *bytes) { uint32_t digits[6]; if (sscanf(string, "%x:%x:%x:%x:%x:%x", &(digits[0]), &(digits[1]), &(digits[2]), &(digits[3]), &(digits[4]), &(digits[5])) != 6) return -1; for (int i = 0; i < 6; i++) { if (digits[i] > 255) return -1; bytes[i] = (uint8_t)digits[i]; } return 0; } int mac_get_direction(libtrace_packet_t *packet, uint8_t *mac_bytes) { uint8_t *src_mac = NULL; uint8_t *dest_mac = NULL; src_mac = trace_get_source_mac(packet); dest_mac = trace_get_destination_mac(packet); if (!src_mac || !dest_mac) { return -1; } if (memcmp(src_mac, mac_bytes, 6) == 0) return 0; else if (memcmp(dest_mac, mac_bytes, 6) == 0) return 1; return -1; } int port_get_direction(libtrace_packet_t *packet) { uint16_t src_port; uint16_t dst_port; int dir = 2; void *l3; uint16_t ethertype; uint32_t rem; libtrace_ip_t *ip = NULL; libtrace_ip6_t *ip6 = NULL; uint8_t proto; src_port = trace_get_source_port(packet); dst_port = trace_get_destination_port(packet); l3 = trace_get_layer3(packet, ðertype, &rem); if (ethertype == TRACE_ETHERTYPE_IP && rem >= sizeof(libtrace_ip_t)) { ip = (libtrace_ip_t *)l3; proto = ip->ip_p; } else if (ethertype == TRACE_ETHERTYPE_IPV6 && rem >= sizeof(libtrace_ip6_t)) { ip6 = (libtrace_ip6_t *)l3; proto = ip6->nxt; } else { return -1; } if (src_port == dst_port) { if (l3 == NULL || rem == 0) return dir; if (ip) { if (ip->ip_src.s_addr < ip->ip_dst.s_addr) dir = 0; else dir = 1; } if (ip6) { if (memcmp(&(ip6->ip_src), &(ip6->ip_dst), sizeof(struct in6_addr)) < 0) { dir = 0; } else { dir = 1; } } } else { if (trace_get_server_port(proto, src_port, dst_port) == USE_SOURCE) { dir = 0; } else { dir = 1; } } return dir; } ================================================ FILE: tools/tools_common.h ================================================ /* * This file is part of libprotoident * * Copyright (c) 2011 The University of Waikato, Hamilton, New Zealand. * Author: Shane Alcock * * With contributions from: * Aaron Murrihy * Donald Neal * * All rights reserved. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libprotoident is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * libprotoident is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with libprotoident; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id$ */ #ifndef TOOLS_COMMON_H_ #define TOOLS_COMMON_H_ #include #include int convert_mac_string(char *string, uint8_t *bytes); int mac_get_direction(libtrace_packet_t *packet, uint8_t *mac_bytes); int port_get_direction(libtrace_packet_t *packet); #endif