Skip to content

Enhance Tubes#63

Merged
david942j merged 6 commits into
masterfrom
feature/tube
Nov 8, 2017
Merged

Enhance Tubes#63
david942j merged 6 commits into
masterfrom
feature/tube

Conversation

@hanhanW
Copy link
Copy Markdown
Collaborator

@hanhanW hanhanW commented Nov 1, 2017


This change is Reviewable

* Implement gets for Tubes
* Implement puts for Tubes
  * Fixed #59
  * Fixed #61
* Catch EOFError in the interative mode ( Fixed #60 )
Comment thread 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)
Copy link
Copy Markdown
Collaborator

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??

Comment thread lib/pwnlib/tubes/tube.rb Outdated
$stdout.write(s)
end
end
rescue
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should only rescue EOFError.

Copy link
Copy Markdown
Collaborator

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

Comment thread lib/pwnlib/tubes/tube.rb Outdated
module Tubes
# Things common to all tubes (sockets, tty, ...)
# @!macro [new] drop_definition
# @param [Boalean] drop
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Boolean

Comment thread lib/pwnlib/tubes/tube.rb
# @!macro timeout_definition
#
# @return [String]
# The next "line".
Copy link
Copy Markdown
Collaborator

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

Comment thread lib/pwnlib/tubes/tube.rb Outdated
$stdout.write(s)
end
end
rescue
Copy link
Copy Markdown
Collaborator

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

@hanhanW
Copy link
Copy Markdown
Collaborator Author

hanhanW commented Nov 1, 2017

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…

Boolean

Done.


lib/pwnlib/tubes/tube.rb, line 206 at r1 (raw file):

Previously, david942j (david942j) wrote…

add examples to clarify its recvuntil-like functionality

Done.


lib/pwnlib/tubes/tube.rb, line 263 at r1 (raw file):

Previously, ShikChen wrote…

Why need to check elem.empty??

Done.


lib/pwnlib/tubes/tube.rb, line 284 at r1 (raw file):

Previously, david942j (david942j) wrote…

Future work: Use our own Exception class

Done.


Comments from Reviewable

Comment thread lib/pwnlib/tubes/tube.rb Outdated
# The difference with IO#gets is using +context.newline+ as default newline.
#
# @param [Integer, String] sep
# The separator.
Copy link
Copy Markdown
Collaborator

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

Comment thread 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.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+IO#gets+

Comment thread 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.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+IO#puts+

@hanhanW
Copy link
Copy Markdown
Collaborator Author

hanhanW commented Nov 2, 2017

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…

+IO#gets+

Done.


lib/pwnlib/tubes/tube.rb, line 201 at r2 (raw file):

Previously, david942j (david942j) wrote…

describe the behavior when an integer is passed

Done.


lib/pwnlib/tubes/tube.rb, line 274 at r2 (raw file):

Previously, david942j (david942j) wrote…

+IO#puts+

Done.


Comments from Reviewable

Comment thread lib/pwnlib/tubes/tube.rb
# s.puts
# puts client.recv
# #
#
Copy link
Copy Markdown
Collaborator

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

Comment thread 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.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be sent

Comment thread lib/pwnlib/tubes/tube.rb Outdated
# 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"+.
Copy link
Copy Markdown
Collaborator

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

@hanhanW
Copy link
Copy Markdown
Collaborator Author

hanhanW commented Nov 2, 2017

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…

+"\n"+ broken in parsed doc

Done.


lib/pwnlib/tubes/tube.rb, line 282 at r3 (raw file):

Previously, david942j (david942j) wrote…

to be sent

Done.


lib/pwnlib/tubes/tube.rb, line 290 at r3 (raw file):

Previously, david942j (david942j) wrote…

add #=> nil, otherwise it looks weird

Done.


Comments from Reviewable

@david942j
Copy link
Copy Markdown
Collaborator

@ShikChen

@david942j
Copy link
Copy Markdown
Collaborator

Reviewed 1 of 2 files at r3, 1 of 1 files at r4.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


Comments from Reviewable

@david942j
Copy link
Copy Markdown
Collaborator

:lgtm:


Review status: all files reviewed at latest revision, 2 unresolved discussions.


Comments from Reviewable

@david942j david942j merged commit 8f31313 into master Nov 8, 2017
@david942j david942j deleted the feature/tube branch November 8, 2017 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants