User

@anonymous


Payments

Payments  

  Por: marcosribeiro em 21 de Novembro de 2017 às 21:05

Hi people.

My question is about the challenge payments, in the module hacking N' Roll.

This question ask: 'Your task is to write a program that, given a number and sequence of paid values, determine the length of the longest period in which the values are within the tolerance level.'

However, the challenge don't let any entries for run on program and get the flag.

Help guys !!!

Re: Payments  

  Por: butt-head em 22 de Novembro de 2017 às 03:53

Hi, marcosribeiro.

You need interact with the server using IP: lab.shellterlabs.com and PORT: xxxxx given when you start the challenge. With these informations you can code your solution.

I hope i helped.

Re: Payments  

  Por: marcosribeiro em 23 de Novembro de 2017 às 18:22

This is the normal input ? This is the same text appearence for me:

Hacking N' Roll

In the first line of the standard input two integers are given, T and N (1 <= T <= 1000, 1 <= n <= 40000), separated by a single space, denoting the tolerance level and the number of payments. The second line gives the values, separated by single spaces.Each payment is an integer from the interval from 1 to 1000.

Example: For the input data: 3 9 5 1 3 5 8 6 6 9 10

The correct result is: 4

Explanation of the example: There are two longer periods, both of length 4: 5, 8, 6, 6 and 8, 6, 6, 9.

The limit for each response will be 2 seconds.

Na primeira linha da entrada padrão são dados dois números inteiros, T e N (1 <= T <= 1000, 1 <= n <= 40000), separados por um único espaço, denotando o nível de tolerância e o número de pagamentos. A segunda linha dá os valores, separadas por espaços únicos. Cada pagamento é um número inteiro do intervalo de 1 a 1000.

Exemplo: Para os dados de entrada: 3 9 5 1 3 5 8 6 6 9 10

O resultado correto é: 4

Explicando o exemplo: Há dois periodos maiores, ambos de tamanho 4: 5, 8, 6, 6 and 8, 6, 6, 9

O limite para cada resposta será de 2 segundos.

start [enter]Case #1: 3 9 5 1 3 5 8 6 6 9 10 invalid input!

Re: Payments  

  Por: butt-head em 24 de Novembro de 2017 às 02:58

Hello again.

As i said before, you need interact with the server using your programming skills. This message that server shows must be analysed by your script(basically, processing that message and send an answer to the server), after that a new message will come and, once again, your code must process this new message and send an answer. If your answer is correct you keep playing until receive the flag; else game is over.

Read about sockets. These links should help: https://docs.python.org/2/library/socket.html https://wiki.python.org.br/SocketBasico (portuguese) https://www.youtube.com/watch?v=wzrGwor2veQ

p.s: links above covers socket in python, but you can code in others languages like: C/C++, Ruby, Java...

I hope i helped

Re: Payments  

  Por: __vulture__ em 25 de Novembro de 2017 às 09:06

@butt-head

Could you manage to solve it in python? Python was too slow for me and I ended up doing it in java.

Re: Payments  

  Por: butt-head em 27 de Novembro de 2017 às 04:24

@vulture

I did not try resolve this challenge in python until now. I suggested python because it's friendly for a kick off in socket study.

Re: Payments  

  Por: marcosribeiro em 27 de Novembro de 2017 às 19:11

Aweosome, guys. I'll use sockets !