Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to know if it's possible to redirect or block HTTP traffic with a string like this command on linux :

iptables -A OUTPUT -p tcp -m string --string "STRING" -j REJECT
share|improve this question

1 Answer 1

up vote 1 down vote accepted

I am not sure I understand the question.

1) If the question is is there iptables in Mac?, the answer is yes, just use this link.

2) if the question is is this correct? then the answer is not completely: why would you want to use REJECT instead of DROP? According to the Man page for iptables,

REJECT

This is used to send back an error packet in response to the matched packet: otherwise it is equivalent to DROP so it is a terminating TARGET, ending rule traversal.

Do you really need the error packet?

3) The last point is: is iptables the correct instrument for Web filtering? Here the answer is most likely not. iptables is for firewalling udp/tcp traffic. If you want to do Web filtering, look at squid, privoxy,...

If however you prefer to do it this way, then the grammar of the command is well exemplified by a post on a sister site, here (see the second reply).

share|improve this answer
    
Are you sure iptables can be installed with macports ? Because I can't find it. Indeed I need a DROP and not a REJECT. I'm looking If I can do what I want with privoxy, thanks –  guillaume Dec 27 '13 at 12:08
    
@guillaume You are indeed right, iptables is not in macports. It has been so long since I downloaded it that I forgot. It can be found here, en.softonic.com/s/iptables:mac/english-mac-x. Apologies. –  MariusMatutiae Dec 27 '13 at 13:00
    
Oh thanks, but Privoxy work well ! And I think I'll build a tiny proxy in C++ or java to do only what I want to do –  guillaume Dec 27 '13 at 13:02
    
@guillaume Glad to hear this. Happy New Year. –  MariusMatutiae Dec 27 '13 at 13:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.