]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Add flag to url object when visible part is url_like
authorMiecio Za <miecio@miecio.net>
Wed, 27 Feb 2019 11:04:10 +0000 (12:04 +0100)
committerMiecio Za <miecio@miecio.net>
Wed, 27 Feb 2019 11:04:10 +0000 (12:04 +0100)
Flag is similar to phished but does not require domains to be
different

src/libserver/html.c
src/libserver/url.h
src/lua/lua_url.c

index 70b66ccc0103c5d866e73babde45baae2c729349..cdcaf4ebbf90e395a51f2367c1a8779a14cf4d92 100644 (file)
@@ -2384,6 +2384,9 @@ rspamd_html_check_displayed_url (rspamd_mempool_t *pool,
                        dest->len - href_offset,
                        &url_found, &displayed_url);
 
+       if (url_found) {
+               url->flags |= RSPAMD_URL_FLAG_DISPLAY_URL;
+       }
        if (exceptions && url_found) {
                ex = rspamd_mempool_alloc (pool,
                                sizeof (*ex));
index 57142409963ebee9b25a14947249015aed0b228c..1a117c450aad99ebcd40c00f35c60a147d9c446b 100644 (file)
@@ -28,6 +28,7 @@ enum rspamd_url_flags {
        RSPAMD_URL_FLAG_SCHEMALESS = 1 << 15,
        RSPAMD_URL_FLAG_UNNORMALISED = 1 << 16,
        RSPAMD_URL_FLAG_ZW_SPACES = 1 << 17,
+       RSPAMD_URL_FLAG_DISPLAY_URL = 1 << 18,
 };
 
 struct rspamd_url_tag {
index 7bad50359a5765c6c60c7358678aa8024faf0d01..58c6a83bea48cc9c2616b4b8190db91d5ca0f39f 100644 (file)
@@ -901,6 +901,7 @@ lua_url_all (lua_State *L)
  * - `schemaless`: URL has no schema
  * - `unnormalised`: URL has some unicode unnormalities
  * - `zw_spaces`: URL has some zero width spaces
+ * - `url_displayed`: URL has some other url-like string in visible part
  * @return {table} URL flags
  */
 #define PUSH_FLAG(fl, name) do { \
@@ -941,6 +942,7 @@ lua_url_get_flags (lua_State *L)
                PUSH_FLAG (RSPAMD_URL_FLAG_SCHEMALESS, "schemaless");
                PUSH_FLAG (RSPAMD_URL_FLAG_UNNORMALISED, "unnormalised");
                PUSH_FLAG (RSPAMD_URL_FLAG_ZW_SPACES, "zw_spaces");
+               PUSH_FLAG (RSPAMD_URL_FLAG_DISPLAY_URL, "url_displayed");
        }
        else {
                return luaL_error (L, "invalid arguments");