-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance Tubes #63
Enhance Tubes #63
Conversation
lib/pwnlib/tubes/tube.rb
Outdated
s = '' | ||
objs.map(&:to_s).each do |elem| | ||
s << elem | ||
s << context.newline if elem.empty? || !elem.end_with?(context.newline) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why need to check elem.empty?
?
lib/pwnlib/tubes/tube.rb
Outdated
@@ -236,6 +281,8 @@ def interact | |||
$stdout.write(s) | |||
end | |||
end | |||
rescue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should only rescue EOFError
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future work: Use our own Exception class
lib/pwnlib/tubes/tube.rb
Outdated
@@ -9,10 +9,18 @@ | |||
module Pwnlib | |||
module Tubes | |||
# Things common to all tubes (sockets, tty, ...) | |||
# @!macro [new] drop_definition | |||
# @param [Boalean] drop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boolean
# @!macro timeout_definition | ||
# | ||
# @return [String] | ||
# The next "line". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add examples to clarify its recvuntil-like functionality
lib/pwnlib/tubes/tube.rb
Outdated
@@ -236,6 +281,8 @@ def interact | |||
$stdout.write(s) | |||
end | |||
end | |||
rescue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future work: Use our own Exception class
Review status: 0 of 2 files reviewed at latest revision, 4 unresolved discussions. lib/pwnlib/tubes/tube.rb, line 13 at r1 (raw file): Previously, david942j (david942j) wrote…
Done. lib/pwnlib/tubes/tube.rb, line 206 at r1 (raw file): Previously, david942j (david942j) wrote…
Done. lib/pwnlib/tubes/tube.rb, line 263 at r1 (raw file): Previously, ShikChen wrote…
Done. lib/pwnlib/tubes/tube.rb, line 284 at r1 (raw file): Previously, david942j (david942j) wrote…
Done. Comments from Reviewable |
lib/pwnlib/tubes/tube.rb
Outdated
# The difference with IO#gets is using +context.newline+ as default newline. | ||
# | ||
# @param [Integer, String] sep | ||
# The separator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
describe the behavior when an integer is passed
lib/pwnlib/tubes/tube.rb
Outdated
alias gets recvline | ||
|
||
# Receives the next "line" from the tube; lines are separated by +sep+. | ||
# The difference with IO#gets is using +context.newline+ as default newline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+IO#gets+
lib/pwnlib/tubes/tube.rb
Outdated
end | ||
|
||
# Sends the given object(s) to the tube. | ||
# The difference with IO#puts is using +context.newline+ as default newline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+IO#puts+
Review status: 0 of 2 files reviewed at latest revision, 7 unresolved discussions. lib/pwnlib/tubes/tube.rb, line 198 at r2 (raw file): Previously, david942j (david942j) wrote…
Done. lib/pwnlib/tubes/tube.rb, line 201 at r2 (raw file): Previously, david942j (david942j) wrote…
Done. lib/pwnlib/tubes/tube.rb, line 274 at r2 (raw file): Previously, david942j (david942j) wrote…
Done. Comments from Reviewable |
lib/pwnlib/tubes/tube.rb
Outdated
# s.puts | ||
# puts client.recv | ||
# # | ||
# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add #=> nil
, otherwise it looks weird
lib/pwnlib/tubes/tube.rb
Outdated
# The difference with +IO#puts+ is using +context.newline+ as default newline. | ||
# | ||
# @param [Array<Object>] objs | ||
# The objects to send. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be sent
lib/pwnlib/tubes/tube.rb
Outdated
@@ -169,12 +180,11 @@ def recvuntil(delims, drop: false, timeout: nil) | |||
end | |||
end | |||
|
|||
# Receive a single line from the tube. | |||
# Receives a single line from the tube. | |||
# A "line" is any sequence of bytes terminated by the byte sequence set in +context.newline+, | |||
# which defaults to +"\n"+. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+"\n"+
broken in parsed doc
Review status: 0 of 2 files reviewed at latest revision, 10 unresolved discussions. lib/pwnlib/tubes/tube.rb, line 185 at r3 (raw file): Previously, david942j (david942j) wrote…
Done. lib/pwnlib/tubes/tube.rb, line 282 at r3 (raw file): Previously, david942j (david942j) wrote…
Done. lib/pwnlib/tubes/tube.rb, line 290 at r3 (raw file): Previously, david942j (david942j) wrote…
Done. Comments from Reviewable |
Reviewed 1 of 2 files at r3, 1 of 1 files at r4. Comments from Reviewable |
Review status: all files reviewed at latest revision, 2 unresolved discussions. Comments from Reviewable |
This change is