Homas / ioc2rpz

ioc2rpz is a place where threat intelligence meets DNS.
Apache License 2.0
105 stars 17 forks source link

ioc2rpz process crashes if a shell script returns data in unicode #47

Closed Homas closed 1 year ago

Homas commented 1 year ago

ioc2rpz process crashes if a shell script returns data in unicode e.g. IDN w/o conversion to punycode E.g.

zzjpoqarqc.duckdns.org
zzqqw1.godaddysites.com
zzqsdlgmlq.duckdns.org
zzzzzzzzzzzzzzz.hyperphp.com
имяенн.010.рус

The error

exit value {badarg,[{erlang,list_to_binary,
.....
file,"/opt/ioc2rpz/src/ioc2rpz_conn.erl"},{line,79}]}

list_to_binary doesn't support unicode. So I need to fix that code:

%IOCs are provided by a local script
get_ioc(<<"shell:",CMD/binary>> = _URL, _Retry) ->
  {ok, list_to_binary(os:cmd(binary_to_list(CMD)))};