def nfq_send_accept(queue_num, qid): global nl buf = bytearray(mnl.MNL_SOCKET_BUFFER_SIZE) nlh = nfq_hdr_put(buf, nfqnl.NFQNL_MSG_VERDICT, queue_num) nlh.nlmsg_flags |= netlink.NLM_F_ACK nfq.nlmsg_verdict_put(nlh, qid, nf.NF_ACCEPT) nl.send_nlmsg(nlh) nrecv = nl.recv_into(buf) return mnl.cb_run(buf[:nrecv], 0, 0, None, None)
def nfq_send_repeat(queue_num, qid, mark, payload): global nl buf = bytearray(mnl.MNL_SOCKET_BUFFER_SIZE + len(payload)) nlh = nfq_hdr_put(buf, nfqnl.NFQNL_MSG_VERDICT, queue_num) nlh.nlmsg_flags |= netlink.NLM_F_ACK nfq.nlmsg_verdict_put(nlh, qid, nf.NF_REPEAT) nlh.put_u32(nfqnl.NFQA_MARK, socket.htonl(mark)); nlh.put(nfqnl.NFQA_PAYLOAD, payload) nl.send_nlmsg(nlh) nrecv = nl.recv_into(buf) return mnl.cb_run(buf[:nrecv], 0, 0, None, None)
def nfq_send_verdict(queue_num, qid): buf = bytearray(mnl.MNL_SOCKET_BUFFER_SIZE) nlh = nfq_hdr_put(buf, nfqnl.NFQNL_MSG_VERDICT, queue_num) nfq.nlmsg_verdict_put(nlh, qid, nf.NF_ACCEPT) nl.send_nlmsg(nlh)
def nfq_send_accept(queue_num, qid): buf = bytearray(mnl.MNL_SOCKET_BUFFER_SIZE) nlh = nfq_hdr_put(buf, nfqnl.NFQNL_MSG_VERDICT, queue_num) nfq.nlmsg_verdict_put(nlh, qid, nf.NF_ACCEPT) nl.send_nlmsg(nlh)